def getMongoDVersion(self):
        binary = "mongod"
        if self.args and self.args.get('binarypath'):
            binary = os.path.join(self.args['binarypath'], binary)

        try:
            out = check_mongo_server_output(binary, '--version')
        except Exception:
            return "0.0"

        buf = BytesIO(out)
        current_version = buf.readline().strip().decode('utf-8')
        # remove prefix "db version v"
        if current_version.rindex('v') > 0:
            current_version = current_version.rpartition('v')[2]

        # remove suffix making assumption that all release candidates
        # equal revision 0
        try:
            if current_version.rindex('-') > 0:  # release candidate?
                current_version = current_version.rpartition('-')[0]
        except Exception:
            pass

        if self.args and self.args['verbose']:
            print("Detected mongod version: %s" % current_version)
        return current_version