想实现一个mongodb 不区分大小写的查询,比如,查询字段为key,key的值为 Rundown,现在想实现的查询的方式key能匹配Rundown ,rundown,但不会匹配Rundown1。请问这个该如何实现了。ps:我用的是mongdb的java 驱动开发,
Use regular expressions, such as:
db.xxx.find( { key: /^rundown$/i } );
{"key" : { "$regex" : "^rundonw1$",$options:"i"}}
The purpose of writing this is to be used in Criteria.regex("^rundonw1$","i").
Use regular expressions, such as:
{"key" : { "$regex" : "^rundonw1$",$options:"i"}}
The purpose of writing this is to be used in Criteria.regex("^rundonw1$","i").