|
| 1 | +--- |
| 2 | +id: replset-opts |
| 3 | +title: 'ReplSetOpts' |
| 4 | +--- |
| 5 | + |
| 6 | +API Documentation of `ReplSetOpts`-Interface |
| 7 | + |
| 8 | +## Values |
| 9 | + |
| 10 | +### auth |
| 11 | + |
| 12 | +Typings: `auth?: boolean | AutomaticAuth` |
| 13 | +Default: `false` |
| 14 | + |
| 15 | +Set wheter to enable Authentication, with configuration from [`AutomaticAuth`](./mongo-memory-server-automaticauth.md). |
| 16 | + |
| 17 | +Also see [`MongoMemoryInstanceOpts.auth`](./mongo-memory-instance-opts.md#auth). |
| 18 | + |
| 19 | +### args |
| 20 | + |
| 21 | +Typings: `args?: string[]` |
| 22 | +Default: `[]` |
| 23 | + |
| 24 | +Set custom arguments to passs to the `mongod` binary. |
| 25 | + |
| 26 | +Also see [`MongoMemoryInstanceOpts.args`](./mongo-memory-instance-opts.md#args). |
| 27 | + |
| 28 | +### dbName |
| 29 | + |
| 30 | +Typings: `dbName?: string` |
| 31 | +Default: `""` |
| 32 | + |
| 33 | +**Currently unused**. |
| 34 | + |
| 35 | +Set a custom dbname to use in `getUri`. |
| 36 | + |
| 37 | +Also see [`MongoMemoryInstanceOpts.dbName`](./mongo-memory-instance-opts.md#dbname). |
| 38 | + |
| 39 | +### ip |
| 40 | + |
| 41 | +Typings: `ip?: string` |
| 42 | +Default: `"127.0.0.1"` |
| 43 | + |
| 44 | +Set which ip to bind to. |
| 45 | + |
| 46 | +Also see [`MongoMemoryInstanceOpts.ip`](./mongo-memory-instance-opts.md#ip). |
| 47 | + |
| 48 | +### name |
| 49 | + |
| 50 | +Typings: `name?: string` |
| 51 | +Default: `"testset"` |
| 52 | + |
| 53 | +Set which replset name to use. |
| 54 | + |
| 55 | +See [MongoDB `replication.replSetName`](https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-replication.replSetName) |
| 56 | + |
| 57 | +### spawn |
| 58 | + |
| 59 | +Typings: `spawn?: SpawnOptions` |
| 60 | +Default: `{}` |
| 61 | + |
| 62 | +Set extra spawn options to pass to `childProcess.spawn`. |
| 63 | + |
| 64 | +Also see [`MongoMemoryInstanceOpts.spawn`](./mongo-memory-instance-opts.md#spawn). |
| 65 | + |
| 66 | +### storageEngine |
| 67 | + |
| 68 | +Typings: `storageEngine?: StorageEngine` |
| 69 | +Default: `"ephemeralForTest"` |
| 70 | + |
| 71 | +Set which Storage Engine to use, uses [`StorageEngine`](./mongo-memory-instance-opts.md#helper-type-storageengine). |
| 72 | + |
| 73 | +Also see [`MongoMemoryInstanceOpts.storageEngine`](./mongo-memory-instance-opts.md#storageengine). |
| 74 | + |
| 75 | +### configSettings |
| 76 | + |
| 77 | +Typings: `configSettings?: MongoMemoryReplSetConfigSettings` |
| 78 | +Default: `{}` |
| 79 | + |
| 80 | +Set custom ReplSet config options |
| 81 | + |
| 82 | +See [MongoDB Replica Set Configuration](https://www.mongodb.com/docs/manual/reference/replica-configuration/). |
| 83 | + |
| 84 | +### count |
| 85 | + |
| 86 | +Typings: `count?: number` |
| 87 | +Default: `1` |
| 88 | + |
| 89 | +Set how many ReplSet members to spawn, this number will be deducted from length of [`instanceOpts`](./mongo-memory-replset-opts.md#instanceopts) array. |
| 90 | + |
| 91 | +:::tip |
| 92 | +It is recommended to set this number to a **odd** number, and try to never have it be **even**, see [MongoDB Deploy an Odd Number of Members](https://www.mongodb.com/docs/v5.2/core/replica-set-architectures/#deploy-an-odd-number-of-members). |
| 93 | +::: |
0 commit comments