regular expression for single quote mark in mongodb

前端 未结 1 1912
悲&欢浪女
悲&欢浪女 2021-01-22 10:15

in mongodb shell client, how can I query to find documents with single quotes? I escaped the quote mark in regex. but it does not work.

db.coll.find({field: /\\\         


        
相关标签:
1条回答
  • 2021-01-22 10:20

    This should work:

    db.coll.find({field: /\x27/});
    

    Where 0x27 is Unicode APOSTROPHE

    From documentation:

    MongoDB regex queries support UTF-8 in the regex string.

    0 讨论(0)
提交回复
热议问题