File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
packages/mongodb-memory-server-core/src Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -402,7 +402,7 @@ export class MongoMemoryServer extends EventEmitter {
402402 ) ;
403403
404404 // After that startup MongoDB instance
405- let instance = await MongoInstance . create ( mongodOptions ) ;
405+ const instance = await MongoInstance . create ( mongodOptions ) ;
406406 log ( '_startUpInstance: Instance Started' ) ;
407407
408408 // another "isNullOrUndefined" because otherwise typescript complains about "this.auth" possibly being not defined
@@ -414,15 +414,9 @@ export class MongoMemoryServer extends EventEmitter {
414414 log ( '_startUpInstance: Killing No-Auth instance' ) ;
415415 await instance . stop ( ) ;
416416
417- // TODO: change this to just change the options instead of an new instance after adding getters & setters
418417 log ( '_startUpInstance: Starting Auth Instance' ) ;
419- instance = await MongoInstance . create ( {
420- ...mongodOptions ,
421- instance : {
422- ...mongodOptions . instance ,
423- auth : true ,
424- } ,
425- } ) ;
418+ instance . instanceOpts . auth = true ;
419+ await instance . start ( ) ;
426420 } else {
427421 console . warn (
428422 'Not Restarting MongoInstance for Auth\n' +
You can’t perform that action at this time.
0 commit comments