python, mongoengine - do like/regex search

前端 未结 1 1617
悲哀的现实
悲哀的现实 2021-02-19 14:45

I know I can do a glob-type search on mongodb:

db.person.find({ name: /*.bob.*/ })

or

db.person.find({ name: { $regex: \'*.b         


        
相关标签:
1条回答
  • 2021-02-19 15:11

    It looks like you can do it this way:

    import re
    
    regex = re.compile('.*bob.*')
    Person.objects(name=regex)
    
    0 讨论(0)
提交回复
热议问题