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

339
Vistas
Mongodb Node JS serverStatus always returns false

I'm new to mongo and am messing around with the admin serverStatus. For me, it always returns false when I am expecting an object. I'm running mongod with auth enabled. Are there specific user privs that are required? I can't find much documentation other than what is supplied by the API docs from the nodejs drivers or the mongodb manual.

MonogDB 3.4 NodeJS drivers 2.2

var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://user:pass@localhost:27017/test?authMechanism=DEFAULT&authSource=test', function(err, db) {
  var adminDB = db.admin();
  adminDB.serverStatus(function(err, status) {
    console.log(status);
    db.close();
  });
});

Thanks!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I found the answer. With auth enabled databases you need to grant a role to the executing user with the serverStatus action.

db.createRole(
   {
     role: "mongostatRole",
     privileges: [
       { resource: { cluster: true }, actions: [ "serverStatus" ] }
     ],
     roles: []
   }
)
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