Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

800
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda