MongoDB Compass

MongoDB Compass中想要用正则搜索字段:

grading
    lexile: "AD450L"

写法是:

{"grading.lexile": {$regex: "AD.*"}}

或:regex加上行首和行尾判断:

{"grading.lexile": {$regex: "^AD.*$"}}

或 regex用引号引起来

{"grading.lexile": {"$regex": "AD.*"}}

具体详见:

高级搜索 · 主流文档型数据库:MongoDB (crifan.org)

results matching ""

    No results matching ""