[SERVER-2705] Shell setSlaveOk() returns unhelpful response Created: 08/Mar/11  Updated: 12/Jul/16  Resolved: 07/Oct/11

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 2.1.0

Type: Improvement Priority: Trivial - P5
Reporter: Kyle Banker Assignee: Antoine Girbal
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Here's what happens when you call setSlaveOk() from the shell

> db.getMongo().setSlaveOk()
not master and slaveok=false

The response is very confusing, since there's no indication that slave ok has been set to true.



 Comments   
Comment by Antoine Girbal [ 07/Oct/11 ]

This was due to SERVER-1401
The error was actually a repeat of whatever previous command you ran.
Now it's good:

SECONDARY> db.test.find()
error:

{ "$err" : "not master and slaveOk=false", "code" : 13435 }

SECONDARY> db.getMongo().setSlaveOk()
SECONDARY> db.test.find()

{ "_id" : ObjectId("4e7120db098c3e1cb12ff351"), "a" : BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=") } { "_id" : BinData(0,"gAAAAAAAAAAAAAAAAAAAAAAAAAA=") }

SECONDARY> db.getMongo().getSlaveOk()
true

Generated at Thu Feb 08 03:00:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.