mongodb $exists always returning 0

后端 未结 2 1615
面向向阳花
面向向阳花 2020-12-11 17:38

I have a database collection (named fols) like so:

{\'followers\':
        {
           \'123\':1
           \'123\':2
           \'123\':3
         }
}
         


        
2条回答
  •  抹茶落季
    2020-12-11 18:14

    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.

提交回复
热议问题