python - How to use AND condtion in mongokit when a key has multiple values -


i have key in document named "tag". has structure this:

"tag": [     {       "schemename": "http:\/\/somesite.com\/categoryscheme2",       "name": "test tag2",       "value": 1,       "slug": "test_tag2"     },     {       "schemaname": "http:\/\/somesite.com\/categoryscheme3",       "name": "test tag3",       "value": 1,       "slug": "test_tag3"     }   ], 

the values of tag can passed ',' separated. how can use values in , condition saying return enrty having tag = test_tag3&test_tag2

itried : conditions['tag.slug'] = { '$and': tags } tags array of tags got :

pymongo.errors.operationfailure  operationfailure: database error: invalid operator: $and 

use $in instead of $and:

conditions['tag.slug'] = { '$in': tags } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -