第6章在MongoDB集合中查找文档
查询就是返回一个集合中文档的子集,子集合的范围从0个文档到整
个文档。
(1)空的查询文档{}会匹配集合的全部内容 db.c.find() //返回
集合C中的所有内容
(2)查找所有age的值为27的文档
// db.test.find({age:27})
(3)查找username为joe的文档
//db.test.find({username:”joe”})
(4)查询所有username为joe且年龄为27岁的文档
//db.test.find({username:”joe”,age: 27})
评论0