title: how to check if mongodb is up and ready to accept connections from bash script?
body: <p>I have a bash shell script which does a bunch of stuff before trying to <code>mongorestore</code>.</p>
  
  <p>I want to make sure that not only MongoDB is up, but it is also ready to accept connections before i try restore.</p>
  
  <p>Right now, what I am seeing is, mongo process is up but it take 45+ seconds to do the initial setup (setting up journal files etc) before it is ready to accept connections. Ideally I want to keep testing the connection in a loop and only when I am able to connect, I want to run <code>mongorestore</code>.</p>
  
  <p>Can someone show me how to do this in Bash or point me in the right direction?</p>