21

I inserted the documents into a particular database in mongoDB. for example

 db.employee.insert({name:"nithin",age:22})
 db.employee.insert({name:"sreedevi",age:32})

now i wnat to retrive the documents whose name ending with character 'i'.

4

1 に答える 1

35

Javascript シェルでは、$regex演算子を使用します

db.employee.find({name: {$regex: "i$"}})
于 2013-02-28T05:01:09.937 に答える