1""" 2Helper functions, constants, and types to aid with MongoDB version support 3""" 4from mongoengine.connection import get_connection 5 6 7# Constant that can be used to compare the version retrieved with 8# get_mongodb_version() 9MONGODB_34 = (3, 4) 10MONGODB_36 = (3, 6) 11 12 13def get_mongodb_version(): 14 """Return the version of the default connected mongoDB (first 2 digits) 15 16 :return: tuple(int, int) 17 """ 18 version_list = get_connection().server_info()["versionArray"][:2] # e.g: (3, 2) 19 return tuple(version_list) 20