How To Combine The Usage Of Operator All And Icontains For Mongoengine
For mongoengine, there are operators all and icontains. But how can I combine the usage of them? Say for each item, I just want to match with icontains but not exact? I tried t
Solution 1:
actually, I recommend using pymongo, install by easy_install pymongo
, in pymongo, you could try:
db.collections.find({'$and':[
{'field A':re.compile('your pattern')},
{'$ne':{'field A':'not exact word'}}
]})
here, $ne
and $and
are native mongo db operators, you could find more details mongodb advnace query
Post a Comment for "How To Combine The Usage Of Operator All And Icontains For Mongoengine"