我有这样的收藏:
{
"_id":"1321464"
"Sex":"Male"
"Age":"20"
"City":"Toronto" #Maybe this field are not present.
}
我想找到我所有的文件与字段“城市”不存在。 我试着:
collection.find({"sex":"Male"},{"City":{"$exists": False}},{'Age': 1, '_id':0})
我有一条错误信息:
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 1239, in find
return Cursor(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line 125, in __init__
raise TypeError("skip must be an instance of int")
TypeError: skip must be an instance of int
向
find
方法传递三个参数。我想你只想通过一个过滤器和一个投影。试试这个:相关问题 更多 >
编程相关推荐