Skip to content

Commit

Permalink
docs(README): add missing "auth" object documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Oct 5, 2023
1 parent 6ce12bf commit 290e57d
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ All options are optional.

```js
const mongod = new MongoMemoryServer({
instance: {
instance?: {
port?: number, // by default choose any free port
ip?: string, // by default '127.0.0.1', for binding to all IP addresses set it to `::,0.0.0.0`,
dbName?: string, // by default '' (empty string)
Expand All @@ -127,14 +127,36 @@ const mongod = new MongoMemoryServer({
auth?: boolean, // by default `mongod` is started with '--noauth', start `mongod` with '--auth'
args?: string[], // by default no additional arguments, any additional command line arguments for `mongod` `mongod` (ex. ['--notablescan'])
},
binary: {
binary?: {
version?: string, // by default '5.0.19'
downloadDir?: string, // see the documentation on what is chosen by default https://nodkz.github.io/mongodb-memory-server/docs/api/config-options#download_dir
platform?: string, // by default os.platform()
arch?: string, // by default os.arch()
checkMD5?: boolean, // by default false OR process.env.MONGOMS_MD5_CHECK
systemBinary?: string, // by default undefined or process.env.MONGOMS_SYSTEM_BINARY
},
// using "auth" will manage "instance.auth"
auth?: {
disable?: boolean, // disable automatic auth creation
customRootName?: string, // by default "mongodb-memory-server-root"
customRootPwd?: string, // by default "rootuser"
force?: boolean, // force creation of users
keyfileContent?: string, // by default "0123456789"
extraUsers?: [{
// see mongodb documentation https://docs.mongodb.com/manual/reference/method/db.createUser/#definition)
createUser: string, // user name
pwd: string, // user password
roles: UserRoles[], // user roles
database?: string, // which database the user is created on
customData?: Record<string, any>,
mechanisms?: ('SCRAM-SHA-1' | 'SCRAM-SHA-256')[],
authenticationRestrictions?: {
clientSource?: string;
serverAddress?: string;
}[],
digestPassword?: boolean,
}],
},
});
```

Expand Down Expand Up @@ -173,7 +195,7 @@ const replSet = new MongoMemoryReplSet({
// 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)
auth?: boolean | AutomaticAuth, // enable auth, for options see #available-options-for-mongomemoryserver
args, // any args specified here will be combined with any per instance args from `instanceOpts`
count, // number of additional `mongod` processes to start (will not start any extra if instanceOpts.length > replSet.count); (default: 1)
dbName, // default database for db URI strings. (default: uuid.v4())
Expand Down

0 comments on commit 290e57d

Please sign in to comment.