I have a collection like this :
{
"_id":"1321464"
"Sex":"Male"
"Age":"20"
"City":"Toronto" #Maybe this field are not present.
}
I want to find all my document with the field "City" not exist. I try :
collection.find({"sex":"Male"},{"City":{"$exists": False}},{'Age': 1, '_id':0})
And i have this error message :
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
You're passing three arguments to the find
method. I assume you intended to pass a filter and a projection only. Try this:
collection.find({"sex":"Male", "City":{"$exists": False}},{'Age': 1, '_id':0})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With