Skip to content

Instantly share code, notes, and snippets.

@danared
Created April 8, 2015 17:39
Show Gist options
  • Save danared/9d1432d80c6c7ebe8130 to your computer and use it in GitHub Desktop.
Save danared/9d1432d80c6c7ebe8130 to your computer and use it in GitHub Desktop.
>>> client = MongoClient(serverSelectionTimeoutMS=500)
>>> try:
... client.admin.command('ping')
... print("it's working")
... except pymongo.errors.ConnectionFailure:
... print("please start mongod")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment