MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / _count_cmd

Method _count_cmd

pymongo/synchronous/collection.py:1986–2004  ·  view source on GitHub ↗

Internal count command helper.

(
        self,
        session: Optional[ClientSession],
        conn: Connection,
        read_preference: Optional[_ServerMode],
        cmd: dict[str, Any],
        collation: Optional[Collation],
    )

Source from the content-addressed store, hash-verified

1984 return RawBatchCursor(self, *args, **kwargs)
1985
1986 def _count_cmd(
1987 self,
1988 session: Optional[ClientSession],
1989 conn: Connection,
1990 read_preference: Optional[_ServerMode],
1991 cmd: dict[str, Any],
1992 collation: Optional[Collation],
1993 ) -> int:
1994 """Internal count command helper."""
1995 res = self._command(
1996 conn,
1997 cmd,
1998 read_preference=read_preference,
1999 codec_options=self._write_response_codec_options,
2000 read_concern=self.read_concern,
2001 collation=collation,
2002 session=session,
2003 )
2004 return int(res["n"])
2005
2006 def _aggregate_one_result(
2007 self,

Callers 1

_cmdMethod · 0.95

Calls 1

_commandMethod · 0.95

Tested by

no test coverage detected