Skip to content

Releases: typegoose/mongodb-memory-server

v2.4.4

17 Oct 16:11
Compare
Choose a tag to compare

2.4.4 (2018-10-17)

Bug Fixes

v2.4.3

06 Oct 07:25
Compare
Choose a tag to compare

2.4.3 (2018-10-06)

Bug Fixes

  • Debian unstable release should use mongod binaries for version 92 (1a74fb4), closes #85

v2.4.2

02 Oct 03:05
Compare
Choose a tag to compare

2.4.2 (2018-10-02)

Bug Fixes

  • TypeScript: add MongoMemoryReplSet to package exports (#83) (600b00b)

v2.4.1

01 Oct 12:01
Compare
Choose a tag to compare

2.4.1 (2018-10-01)

Bug Fixes

  • MongoMemoryReplSet.js: emit ‘init’, ‘running’, and ‘stopped’ to allow for easier cleanup of listeners (#82) (f5ae10a)

v2.4.0

30 Sep 10:38
Compare
Choose a tag to compare

2.4.0 (2018-09-30)

Features

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

27 Sep 20:02
Compare
Choose a tag to compare

2.3.0 (2018-09-27)

Features

v2.2.0

13 Sep 06:44
Compare
Choose a tag to compare

2.2.0 (2018-09-13)

Features

  • add possibility to provide config via environment variables (#77) (27a8de1), closes #76

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

28 Aug 08:17
Compare
Choose a tag to compare

2.1.0 (2018-08-28)

Bug Fixes

  • in generateConnectionString() changed localhost to 127.0.0.1 (7bdc367), closes #73

Features

  • MongoInstance: add a new option instance.ip for binding mongod instance to specified ip addresses (by default 127.0.0.1). For binding to all IP addresses set it to ::,0.0.0.0 (bbf75b8)

v2.0.1

21 Aug 15:24
Compare
Choose a tag to compare

2.0.1 (2018-08-21)

Bug Fixes

v2.0.0

17 Aug 06:04
Compare
Choose a tag to compare

2.0.0 (2018-08-17)

BREAKING CHANGES

  • change default mongodb version to latest (#70) (742bead)
  • remove NodeJS v4 support (dc57509)

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 mongodb-memory-server@1.9.3)
  • your tests work with latest version of MongoDB (before was hardcoded default version 3.4.4). Anyway you may set explicitly any MongoDB version via configuration options:
const mongod = new MongodbMemoryServer({
  binary: {
    version: '3.4.4', 
  },
});