Skip to main content
DevTools24

MongoDB 查询构建器

可视化构建 MongoDB 查询。使用条件构建器创建 find、aggregate 和 update 查询。

db.users.find({
  "status": "active"
})
const result = await db.collection("users").find(
  {
    "status": "active"
  }
).toArray();

MongoDB Queries - 技术详情

MongoDB uses JSON-like documents for queries. Use find() with query filters, projection for field selection, and sort/limit/skip for pagination. Aggregation pipeline stages like $match, $group, $project enable complex data transformations.

命令行替代方案

// Find with conditions\ndb.users.find(\n  { age: { $gte: 18 } },\n  { name: 1, email: 1 }\n).sort({ name: 1 })

参考

查看官方规范