Builds a mongodb query from a semver string