Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我想查询数组中的字段是否可以这样做
students.find({'name':{$in:['Mark','Jerry']}})
但是如果我想在一个 mongodb 对象的数组中找到一个字符串,比如
{ "name":"Jerry", "classes":["math","english","nature"] }
如何查询此 mongodb 对象的 classes 数组中的类名“science”是否?
谢谢
只是:
db.students.find({'classes': 'science'})