Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

799
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda