Skip to content

Conversation

@gummiboll
Copy link

Connection check always returns OK since MongoClient doesn't block since pymongo 3.0 (see: http://api.mongodb.org/python/current/api/pymongo/mongo_client.html). With this pull-request check_mongodb.py tries to determine which version of mongodb is running directly after mongo_connect so if a bogus host/port is used or mongodb isnt running it will throw a error.

-M is kept so it doesn't break current installations, if -M is specified mongo_version is set to what the user specified if not the autodetected version is used. Also changed mongo_version to a int instead of string.

PS. Don't have any mongodb 3.x installation to test this on so not certain it wont break those.
PPS. Also removed some trailing whitespaces.

@warrenpnz
Copy link
Contributor

Nice, I was just removing the -M option and using # mongo_version = con.server_info()['version'].split('.')[0].strip()
Yours is a lot more error resistant, so I've updated mine to use that now. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants