对于mongoengine,有运营商all
和icontains
。 但我怎么能结合他们的使用情况如何?
假设每个项目,我只是想配合icontains
但不能exact
? 我试图用正则表达式。 我的作品,但不幸的是,如果我有1个多它会打破Q
在mongoengine的查询集。 因为它会尝试deepcopy
的pattern
对象,但不幸的是pattern
的对象不能被深深复制。
对于mongoengine,有运营商all
和icontains
。 但我怎么能结合他们的使用情况如何?
假设每个项目,我只是想配合icontains
但不能exact
? 我试图用正则表达式。 我的作品,但不幸的是,如果我有1个多它会打破Q
在mongoengine的查询集。 因为它会尝试deepcopy
的pattern
对象,但不幸的是pattern
的对象不能被深深复制。
其实,我建议使用pymongo ,通过安装easy_install pymongo
,在pymongo,你可以尝试:
db.collections.find({'$and':[
{'field A':re.compile('your pattern')},
{'$ne':{'field A':'not exact word'}}
]})
在这里, $ne
和$and
原产蒙戈DB运营商,你会发现更多的细节MongoDB的advnace查询