【发布时间】:2013-04-18 17:13:21
【问题描述】:
我收到此错误:
TypeError: 'Cursor' 类型的对象没有 len()
当我尝试执行时:
reply = db['test'].find({"date":{"$gt":date_query}} ,{"date":1,"route_id":1,"loc":1,"_id":0})
length = len(reply)
【问题讨论】:
-
这是因为您所做的只是定义了作为服务器查询请求的游标 - 您实际上并没有得到一组结果(因为通常您会遍历一个游标来获取批量文件)。
标签: python mongodb pymongo database-cursor