i am a beginner in python and mongodb. My database is like this
{ '_id' : 1,
'identity' : {
'first_name' : 'John',
'last_name' : 'Doe',
'phone' : '+440823XXX'
}
'status' : 'active'
}
I want to return data which phone is empty or doesn't exists in db. I tried
db.collection.find({"identity" : { "phone" : { "$exists": "true", "$ne": "null" } }})
But it returned <pymongo.cursor.Cursor at 0x7f5da40e8e80>
How the sintax for getting the query which the value is not empty?
db.collection.find({"identity"."phone" : { "$exists": "true", "$ne": "null" } }})db.collection.find({"identity.phone" { $exists: "true", $ne: "null" } })