(mongo_query)
Extract the command (find, count or aggregate) from the query. Even though mongo and pymongo are supposed
        to work with the query as a single document, pymongo expects the command to be the `first` element of the
        query dict.
        Because python 2 dicts are not ordered, the command is extracted to be later run as the first argument
        of pymongo `runcommand`
Extract the command (find, count or aggregate) from the query. Even though mongo and pymongo are supposed
        to work with the query as a single document, pymongo expects the command to be the `first` element of the
        query dict.
        Because python 2 dicts are not ordered, the command is extracted to be later run as the first argument
        of pymongo `runcommand`
Extract the command ( find count or aggregate ) from the query . Even though mongo and pymongo are supposed to work with the query as a single document pymongo expects the command to be the first element of the query dict . Because python 2 dicts are not ordered the command is extracted to be later run as the first argument of pymongo runcommand
def _extract_command_from_mongo_query(mongo_query):
        """Extract the command (find, count or aggregate) from the query. Even though mongo and pymongo are supposed
        to work with the query as a single document, pymongo expects the command to be the `first` element of the
        query dict.
        Because python 2 dicts are not ordered, the command is extracted to be later run as the first argument
        of pymongo `runcommand`
        """
        for command in ALLOWED_CUSTOM_QUERIES_COMMANDS:
            if command in mongo_query:
                return command
        raise ValueError("Custom query command must be of type {}".format(ALLOWED_CUSTOM_QUERIES_COMMANDS))
def _extract_command_from_mongo_query ( mongo_query ) : for command in ALLOWED_CUSTOM_QUERIES_COMMANDS : if command in mongo_query : return command raise ValueError ( "Custom query command must be of type {}" . format ( ALLOWED_CUSTOM_QUERIES_COMMANDS ) )