pymongo- How can I have distinct values for a field along with other query parameters

前端 未结 3 680
無奈伤痛
無奈伤痛 2021-02-03 20:01

I am using pymongo and want to have distinct values for a field such that I can also pass other query parameters. For example, I have entries like:

{
   id = \"m         


        
3条回答
  •  抹茶落季
    2021-02-03 20:19

    Actually there is a filter parameter you can pass in distinct method as mentioned in the pymongo Doc,

    Pymongo Distinct

    like this

    distinct_tags = db.mycoll.distinct("tags",{"category": "movie"})
    

提交回复
热议问题