Skip to content

Instantly share code, notes, and snippets.

@sghill
Last active December 11, 2015 06:19
Show Gist options
  • Save sghill/4558413 to your computer and use it in GitHub Desktop.
Save sghill/4558413 to your computer and use it in GitHub Desktop.
Detect in a shell script if you're running the right mongo version. Helpful when using mongodump, whose dump format changed to be unusable by earlier versions of mongod. see: http://docs.mongodb.org/manual/reference/mongodump/
if [[ -z $(mongo --version | grep '2.0.1') ]]; then
echo "expected 2.0.1, got $(mongo --version)"
exit 1
else
echo "we have the right version"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment