(self, mask)
return self
Set arbitrary query flags using a bitmask.

        To set the tailable flag:
        cursor.add_option(2)
Set arbitrary query flags using a bitmask.
Set arbitrary query flags using a bitmask .
def add_option(self, mask):
        """Set arbitrary query flags using a bitmask.

        To set the tailable flag:
        cursor.add_option(2)
        """
        if not isinstance(mask, int):
            raise TypeError("mask must be an int")
        self.__check_okay_to_chain()

        if mask & _QUERY_OPTIONS["exhaust"]:
            if self.__limit:
                raise InvalidOperation("Can't use limit and exhaust together.")
            if self.__collection.database.client.is_mongos:
                raise InvalidOperation('Exhaust cursors are '
                                       'not supported by mongos')
            self.__exhaust = True

        self.__query_flags |= mask
        return self
def add_option ( self , mask ) : if not isinstance ( mask , int ) : raise TypeError ( "mask must be an int" ) self . __check_okay_to_chain ( ) if mask & _QUERY_OPTIONS [ "exhaust" ] : if self . __limit : raise InvalidOperation ( "Can't use limit and exhaust together." ) if self . __collection . database . client . is_mongos : raise InvalidOperation ( 'Exhaust cursors are ' 'not supported by mongos' ) self . __exhaust = True self . __query_flags |= mask return self