Skip to content

Commit

Permalink
docs(mongo-memory-instance-opts): add file
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Jun 15, 2022
1 parent b937ce4 commit fb40d33
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
97 changes: 97 additions & 0 deletions docs/api/interfaces/mongo-memory-instance-opts.md
@@ -0,0 +1,97 @@
---
id: mongo-memory-instance-opts
title: 'MongoMemoryInstanceOpts'
---

API Documentation of `MongoMemoryInstanceOpts`-Interface

## Values for `MongoMemoryInstanceOpts`

Inherits from [`MongoMemoryInstanceOptsBase`](#values-for-mongomemoryinstanceoptsbase).

### auth

Typings: `auth?: boolean`
Default: `false`

Set which option auth argument to add:

- if `true`, add `--auth`
- if `false`, add `--noauth`

This options gets automatically set (overwritten) when using `createAuth`.

### dbName

Typings: `dbName?: string`

Previously set the `dbName` for the `getUri` calls, but currently unused.

### ip

Typings: `ip?: string`

Set the ip to bind to, if defined will add the argument `--bind_ip` with the input string.

### replSet

Typings: `replSet?: string`

Set the ReplSet name to use, if defined will add the argument `--replSet` with the input string.

### keyfileLocation

Typings: `keyfileLocation?: string`

Set a custom location for where the keyfile for authentication will be stored, if defined will add the argument `--keyfile` with the input string.
Only has a effect when used in a [`MongoMemoryReplSet`](../classes/mongo-memory-replset.md) and `auth` is enabled.
This option will get automatically set when not manually defined.

## Values for `MongoMemoryInstanceOptsBase`

### args

Typings: `args?: string[]`

Set extra Arguments to add to the started instance, will likely overwrite arguments set by other options, depending on how the binary parses arguments.

### port

Typings: `port?: number`

When set, adds the `--port` argument with the input.
This options will get automatically set with a free port that is found.

### dbPath

Typings: `dbPath?: string`

When set, adds the `--dbpath` argument with the input.
This option will automatically be set with a directory generated by [`tmp`](https://www.npmjs.com/package/tmp).

### storageEngine

Typings: `storageEngine?: StorageEngine`
Default: `ephemeralForTest`

Set which storage engine to use, uses [`StorageEngine`](#helper-type-storageengine).

### replicaMemberConfig

Typings: `replicaMemberConfig?: ReplicaMemberConfig`

Set custom a custom Replica Member Config, uses [`ReplicaMemberConfig`](TODO).
Only has a effect when started with [`MongoMemoryReplSet`](../classes/mongo-memory-replset.md).

## Helper Type `StorageEngine`

Typings: `StorageEngine = 'devnull' | 'ephemeralForTest' | 'mmapv1' | 'wiredTiger'`

Storage Engines supported by mongodb, see [MongoDB Storage Engines](https://www.mongodb.com/docs/manual/core/storage-engines/).

Custom Explanation:

- `devnull` is a storage engine which discards everything and cannot be read from.
- `ephemeralForTest` is a in-memory storage engine, which stores everything in RAM, which is great to use when wanting a simple database testing backend, is not the same as the Enterprise In-Memory Engine
- `mmapv1` is storage engine which stores data on disk, was removed in mongodb 4.2
- `wiredTiger` is a storage engine which stores data on disk.
2 changes: 1 addition & 1 deletion docs/api/interfaces/mongo-memory-server-opts.md
Expand Up @@ -11,7 +11,7 @@ API Documentation of `MongoMemoryServerOpts`-Interface

Typings: `instance?: MongoMemoryInstanceOpts`

Set custom options for the instance, uses [`MongoMemoryInstanceOpts`](TODO).
Set custom options for the instance, uses [`MongoMemoryInstanceOpts`](./mongo-memory-instance-opts.md).

### binary

Expand Down
1 change: 1 addition & 0 deletions website/sidebars.js
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'api/interfaces/mongo-memory-server-opts',
'api/interfaces/mongo-memory-server-automaticauth',
'api/interfaces/mongo-memory-server-createuser',
'api/interfaces/mongo-memory-instance-opts',
],
},
guides: {
Expand Down

0 comments on commit fb40d33

Please sign in to comment.