2016-03-29 52 views

回答

2

Regex是你最好的選擇:

db.collection.find({name: /^adam$/i}) 

如果你預先3.2,那麼你就需要使用$regex操作:

db.collection.find({name: { $regex: /^adam$/, $options: 'i'}}) 
0
db.contacts.find({firstName: /^adam$/i })