forked from Automattic/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repl.js
35 lines (31 loc) · 762 Bytes
/
repl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
run().catch(error => {
console.error(error);
process.exit(-1);
});
async function run() {
const ReplSet = require('mongodb-memory-server').MongoMemoryReplSet;
// Create new instance
const replSet = new ReplSet({
binary: {
version: process.argv[2]
},
instanceOpts: [
// Set the expiry job in MongoDB to run every second
{
port: 27017,
args: ['--setParameter', 'ttlMonitorSleepSecs=1']
}
],
dbName: 'mongoose_test',
replSet: {
name: 'rs0',
count: 2,
storageEngine: 'wiredTiger'
}
});
await replSet.start();
await replSet.waitUntilRunning();
console.log('MongoDB-ReplicaSet is now running.');
console.log(replSet.getUri('mongoose_test'));
}