core.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:SanicMongo 作者: beepaste 项目源码 文件源码
def find(self, *args, **kwargs):
        """Create a :class:`SanicMongoAgnosticCursor`. Same parameters as for
        PyMongo's :meth:`~pymongo.collection.Collection.find`.

        Note that ``find`` does not take a `callback` parameter, nor does
        it return a Future, because ``find`` merely creates a
        :class:`SanicMongoAgnosticCursor` without performing any operations
        on the server.
        ``SanicMongoAgnosticCursor`` methods such as
        :meth:`~SanicMongoAgnosticCursor.to_list` or
        :meth:`~SanicMongoAgnosticCursor.count` perform actual operations.
        """
        if 'callback' in kwargs:
            raise pymongo.errors.InvalidOperation(
                "Pass a callback to each, to_list, or count, not to find.")

        cursor = self.delegate.find(*args, **kwargs)
        cursor_class = create_class_with_framework(
            SanicMongoAgnosticCursor, self._framework, self.__module__)

        return cursor_class(cursor, self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号