如何使用python从mongodb获取游标的长度? [英] How to get the length of a cursor from mongodb using python?

查看:802
本文介绍了如何使用python从mongodb获取游标的长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种可行的方法来获取从MongoDB获取的游标的长度.

I'm looking for a feasible way to get the length of cursor got from MongoDB.

推荐答案

cursor.count 方法.

推荐的方法是使用 count_documents 集合的方法.

The recommended method is to use the count_documents method of the collection.

这篇关于如何使用python从mongodb获取游标的长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆