查询文档
db.inventory.insertMany([
{ item: "journal", qty: 25, size: { h: 14, w: 21, uom: "cm" }, status: "A" },
{ item: "notebook", qty: 50, size: { h: 8.5, w: 11, uom: "in" }, status: "A" },
{ item: "paper", qty: 100, size: { h: 8.5, w: 11, uom: "in" }, status: "D" },
{ item: "planner", qty: 75, size: { h: 22.85, w: 30, uom: "cm" }, status: "D" },
{ item: "postcard", qty: 45, size: { h: 10, w: 15.25, uom: "cm" }, status: "A" }
]);检索集合中的所有文档
db.inventory.find( {} )SELECT * FROM inventory等值查询
{ <field1>: <value1>, ... }查询条件中使用查询操作符
AND条件
OR条件
同时使用AND和OR条件
其他查询教程
行为
其它的方法
最后更新于