How use sql “like” in PyMongo?

前端 未结 1 706
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 15:16

How use sql \"like\" in PyMongo?

>>> db.houses.find().count()
11616
>>> db.houses.find({\"hid\":u\"16999\"}).count()
1
>>> db.hous         


        
相关标签:
1条回答
  • 2020-12-28 15:45

    pymongo doesn't support regex literals, you have to use the '$regex' predicate:

     db.houses.find({"hid":{"$regex": u"9"}})
    
    0 讨论(0)
提交回复
热议问题