diff --git a/src/cluster.ts b/src/cluster.ts index 9f8ce6a0..d7224f6f 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -100,10 +100,12 @@ export class Cluster { const results = await Promise.all(this.#protocols.map((protocol) => { return protocol.commandSingle( "admin", - { hello: 1 }, + { isMaster: 1 }, ); })); - const masterIndex = results.findIndex((result) => result.isWritablePrimary); + const masterIndex = results.findIndex((result) => + result.isWritablePrimary || result.ismaster + ); if (masterIndex === -1) throw new Error(`Could not find a master node`); this.#masterIndex = masterIndex; }