I have a database collection (named fols) like so:
{\'followers\':
{
\'123\':1
\'123\':2
\'123\':3
}
}
When you're not matching a complete object you need to use dot notation to use an operator against an embedded object. So in this case:
cursor = fols.find({'followers.123':{'$exists': True}})
Try the dot syntax:
cursor = fols.find({'followers.123': {'$exists': True}})
But also see my comment above. You can't have the same key more than once in a (sub-)document.