(self, cmd, collation=None)
return int(res["n"])
Internal count helper.
Internal count helper.
Internal count helper .
def _count(self, cmd, collation=None):
        """Internal count helper."""
        with self._socket_for_reads() as (sock_info, slave_ok):
            res = self._command(
                sock_info, cmd, slave_ok,
                allowable_errors=["ns missing"],
                codec_options=self.__write_response_codec_options,
                read_concern=self.read_concern,
                collation=collation)
        if res.get("errmsg", "") == "ns missing":
            return 0
        return int(res["n"])
def _count ( self , cmd , collation = None ) : with self . _socket_for_reads ( ) as ( sock_info , slave_ok ) : res = self . _command ( sock_info , cmd , slave_ok , allowable_errors = [ "ns missing" ] , codec_options = self . __write_response_codec_options , read_concern = self . read_concern , collation = collation ) if res . get ( "errmsg" , "" ) == "ns missing" : return 0 return int ( res [ "n" ] )