Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

798
Views
How can I use rs.slaveOK() on mongo shell?

I have checked the official document many times, it dose has the rs.slaveOK() function there and also the shell-help document.

shell-help document

I can't use rs.slaveOK() even if the function really exist.(Error occur)

That is so weird. Why is that?

The shell try to indicate me that rs.slaveOK() is not a function when I type it.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Be careful! MongoDB functions are case sensitive:

rs.slaveOK() is not a function

rs.slaveOk() is the function you are looking for.

over 4 years ago · Santiago Trujillo Report

0

You would use rs.slaveOk() when your Mongodb is set up as a replicaset, and you wish to query one of the secondary nodes, rather than the primary. slaveOk is instructing the shell that its ok to return results from a secondary (rather than a primary) even though the results may not be entirely consistent with the primary.

I could be wrong, but it doesn't look like you are connected to a Mongodb which is configured as a replicaset, and if you are then I'm guessing that you are not connected to a secondary. Therefore the instruction to query a secondary makes no sense.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!