Description
Tab completion on a secondary won't work without setting the appropriate read preference.
rs0 [direct: secondary]> db.slaTab completion error: MongoError: not master and slaveOk=false
|
at MessageStream.messageHandler (/home/alex/Workspace/mongo/mongosh:46582:20)
|
at MessageStream.emit (events.js:315:20)
|
at MessageStream.EventEmitter.emit (domain.js:486:12)
|
at processIncomingData (/home/alex/Workspace/mongo/mongosh:43478:12)
|
at MessageStream._write (/home/alex/Workspace/mongo/mongosh:43374:5)
|
at writeOrBuffer (_stream_writable.js:352:12)
|
at MessageStream.Writable.write (_stream_writable.js:303:10)
|
at Socket.ondata (_stream_readable.js:719:22)
|
at Socket.emit (events.js:315:20)
|
at Socket.EventEmitter.emit (domain.js:486:12) {
|
topologyVersion: { processId: ObjectId("601c0d6951aabc0c661dc8d2"), counter: 4 },
|
ok: 0,
|
code: 13435,
|
codeName: 'NotPrimaryNoSecondaryOk',
|
'$clusterTime': {
|
clusterTime: Timestamp(1, 1612451538),
|
signature: {
|
hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
|
keyId: 0
|
}
|
},
|
operationTime: Timestamp(1, 1612451538)
|
However SERVER-49990 removes `setSlaveOk` which users are used to and the MongoError still alludes to.
rs0 [direct: secondary]> db.getMongo().setSlaveOk(true)
|
MongoshDeprecatedError: [COMMON-10003] setSlaveOk is deprecated.
|
Trying to set slaveOk does not point users to anything relevant. If you discover the alias (SERVER-49990) and try this the error is a little more helpful at least:
rs0 [direct: secondary]> db.getMongo().setSecondaryOk(true)
|
MongoshDeprecatedError: [COMMON-10003] Setting secondaryOk is deprecated, use setReadPref instead
|
Making the setSlaveOk and setSecondaryOk errors the same would at least make this a little easier for users to action. Adding documentation links to the errors would be even better