def count(self, with_limit_and_skip=False):
        if not isinstance(with_limit_and_skip, bool):
            raise TypeError("with_limit_and_skip must be an instance of bool")
        command = {"query": self.__spec, "fields": self.__fields}

        command['read_preference'] = self.__read_preference
        command['tag_sets'] = self.__tag_sets
        command['secondary_acceptable_latency_ms'] = (
            self.__secondary_acceptable_latency_ms)
        command['slave_okay'] = self.__slave_okay
        use_master = not self.__slave_okay and not self.__read_preference
        command['_use_master'] = use_master
        if self.__max_time_ms is not None:
            command["maxTimeMS"] = self.__max_time_ms
        if self.__comment:
            command['$comment'] = self.__comment

        if with_limit_and_skip:
            if self.__limit:
                command["limit"] = self.__limit
            if self.__skip:
                command["skip"] = self.__skip

        database = self.__collection.database
        r = database.command("count", self.__collection.name,
                             allowable_errors=["ns missing"],
                             uuid_subtype=self.__uuid_subtype,
                             compile_re=self.__compile_re,
                             **command)
        if r.get("errmsg", "") == "ns missing":
            return 0
        return int(r["n"])
Process dictionary values.
dataset/ETHPy150Open blynch/CloudMemeBackend/pymongo/cursor.py/Cursor.count--crossover with--dataset/ETHPy150Open openstack/anvil/anvil/cfg.py/YamlRefLoader._process_dict