Releases: typegoose/mongodb-memory-server
Releases · typegoose/mongodb-memory-server
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)
}
});
v2.3.0
v2.2.0
2.2.0 (2018-09-13)
Features
This improvement will be useful if you use Gitlab or any other CI and want to provide correct version and folder for installing mongod binary on npm install. More details in #76
Avaliable env variables:
MONGOMS_DOWNLOAD_DIR=/path/to/mongodb/binaries
MONGOMS_PLATFORM=linux
MONGOMS_ARCH=x64
MONGOMS_VERSION=3.4.4
MONGOMS_DEBUG=1 # also available case-insensitive values: "on" "yes" "true"
v2.1.0
v2.0.1
v2.0.0
2.0.0 (2018-08-17)
BREAKING CHANGES
Most users will not have problems with migration to a new version if:
- you use
Node >= 6.0.0(if not upgrade node version or use [email protected]) - your tests work with
latestversion of MongoDB (before was hardcoded default version3.4.4). Anyway you may set explicitly any MongoDB version via configuration options:
const mongod = new MongodbMemoryServer({
binary: {
version: '3.4.4',
},
});