Releases: typegoose/mongodb-memory-server
Releases · typegoose/mongodb-memory-server
v2.6.2
v2.6.1
v2.6.0
v2.5.0
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
2.4.0 (2018-09-30)
Features
- add MongoMemoryReplSet class (#81) thanks @jloveridge (5911cdc)
Replica Set start:
import { MongoMemoryReplSet } from 'mongodb-memory-server';
const replSet = new MongoMemoryReplSet();
await replSet.waitUntilRunning();
const uri = await mongod.getConnectionString();
const port = await mongod.getPort();
const dbPath = await mongod.getDbPath();
const dbName = await mongod.getDbName();
// some code
// stop replica set manually
replSet.stop();
// or it should be stopped automatically when you exit from script
Available options
All options are optional.
const replSet = new MongoMemoryReplSet({
autoStart, // same as for MongoMemoryServer
binary: binaryOpts, // same as for MongoMemoryServer
debug, // same as for MongoMemoryServer
instanceOpts: [
{
args, // any additional instance specific args
port, // port number for the instance
dbPath, // path to database files for this instance
storageEngine, // same storage engine options
},
// each entry will result in a MongoMemoryServer
],
// unless otherwise noted below these values will be in common with all instances spawned.
replSet: {
name, // replica set name (default: 'testset')
auth, // enable auth support? (default: false)
args, // any args specified here will be combined with any per instance args from `instanceOpts`
count, // number of `mongod` processes to start; (default: 1)
dbName, // default database for db URI strings. (default: uuid.v4())
ip, // by default '127.0.0.1', for binding to all IP addresses set it to `::,0.0.0.0`
oplogSize, // size (in MB) for the oplog; (default: 1)
spawn, // spawn options when creating the child processes
storageEngine, // default storage engine for instance. (Can be overridden per instance)
}
});