Take your data with you.
Create authenticated encrypted backups and restore into a new store.
Back up a stopped store
const password = process.env.MY_BACKUP_PASSWORD;
await BsonLite.disconnect();
const backup = await BsonLite.backup({
directory: './Database',
file: './backups/myapp.bslbackup',
password
});Use a strong password of at least 16 characters and keep it separately. The store must be stopped, including independently opened handles or other applications. Save backups outside Database. An existing backup destination is preserved rather than overwritten.
Restore to a new directory
await BsonLite.restore({
directory: './RestoredDatabase',
file: './backups/myapp.bslbackup',
password: process.env.MY_BACKUP_PASSWORD
});
await BsonLite.connect({ directory: './RestoredDatabase' });Restore requires a nonexistent destination directory. It authenticates the archive before creating destination data, preserves native cipher settings and wraps the key for the destination account. Physical backups require the same OS, architecture and engine profile.
Know what the archive contains
The authenticated encrypted archive includes a file manifest, database name, credentials, native key and cipher metadata as well as the database files. Wrong passwords, tampering, unsafe paths and incompatible profiles are refused. No temporary plaintext export archive is part of this backup design.
Keep more than one backup and test restoration on a disposable destination. Loss of every matching key, backup and password has no vendor bypass. Cross-PC restoration is designed into key wrapping but remains additional release validation.
Documentation for BsonLite 0.6.0-rc.1. View SDK source · Download the validated SDK