Skip to content

Commit 78d5aee

Browse files
committed
fix(MongoMemoryReplSet): fix creating auth regardless of "enableAuth"
1 parent c958b07 commit 78d5aee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/mongodb-memory-server-core/src/MongoMemoryReplSet.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,12 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
708708
log('_initReplSet: trying "replSetInitiate"');
709709
await adminDb.command({ replSetInitiate: rsConfig });
710710

711-
if (typeof this._replSetOpts.auth === 'object') {
712-
log('_initReplSet: "this._replSetOpts.auth" is a object');
711+
if (this.enableAuth()) {
712+
log('_initReplSet: "enableAuth" returned "true"');
713713

714714
await this._waitForPrimary(undefined, '_initReplSet authIsObject');
715715

716+
// find the primary instance to run createAuth on
716717
const primary = this.servers.find(
717718
(server) => server.instanceInfo?.instance.isInstancePrimary
718719
);

0 commit comments

Comments
 (0)