Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

293
Views
Check Field Exist in Pymongo

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
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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})
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!