mongodb 不区分大小写查询
滿天的星座
滿天的星座 2017-05-02 09:21:56
0
2
672

想实现一个mongodb 不区分大小写的查询,比如,查询字段为key,key的值为 Rundown,
现在想实现的查询的方式key能匹配Rundown ,rundown,但不会匹配Rundown1。
请问这个该如何实现了。
ps:我用的是mongdb的java 驱动开发,

滿天的星座
滿天的星座

répondre à tous(2)
仅有的幸福

Utilisez des expressions régulières, telles que :

db.xxx.find( { key: /^rundown$/i } );
Peter_Zhu

{"key" : { "$regex" : "^rundonw1$",$options:"i"}}

Le but de l'écriture de ceci est d'être utilisé dans Criteria.regex("^rundonw1$", "i").

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!