mongodb-js / mongodb-prebuilt

Install MongoDB prebuilt package using npm https://npmjs.org/package/mongodb-prebuilt
ISC License
56 stars 50 forks source link

Check server status #44

Open cyberwombat opened 7 years ago

cyberwombat commented 7 years ago

I need to find if mongo has been started. I am using this in some parallel testing where the pocesses are sandboxed. Right now I am checking to see if the port is open using the net module but I wonder if I can get this from the mongo code.

I see there is the serverStatus command for Mongo but running it like this doesn't return any info.

 return new MongodbPrebuilt.MongoBins('mongo', ['--port', options.port, '--eval', "db.serverStatus()"]).run()

Is there a way to get the output of that command back?