文档
Aggregation Stage Palette
将 ~40 个 MongoDB aggregation stage operators 中的任意一个直接拖到您的 pipeline 上。按名称或描述搜索;在 stages 之间放下以在确切位置插入。
它做什么
aggregation pipeline 构建器有一个带两种模式的侧面板:"Wizards"(8 个精选用例 cards)和 "All stages"(完整 $stage 目录作为可拖动 cards)。将任意 card 拖到现有 stages 之间的 drop zone,新 stage 在该位置插入,带选定的预先选择的 operator,可编辑。
如何打开
- 打开任何 collection 并创建一个新的 Aggregation pipeline。
- 点击 toolbar 中的 "Stages" 图标以切换侧面板。
两种模式
Wizards(默认)
8 个用例形状的 cards(Match documents、Group with statistics、Top-N per group、Join from another collection 等)。每个 card 打开一个引导表单,生成带说明的完整 stage。最适合新手和快速一次性 pipelines。
All stages
~40 个 cards,每个 MongoDB stage operator 一个。每个 card 将 operator 名称显示为徽章、2 行描述,以及 hover 时带完整文档文本的 tooltip。最适合当您知道想要哪个 stage 并需要快速插入时。
拖放流程
- 在 "All stages" 模式下,找到您想要的 stage(使用搜索框过滤)。
- 点击并按住 card,在 pipeline 上拖动。蓝色水平条出现在每个有效的 drop 位置(在 stages 之间、第一个之前、最后一个之后)。
- 释放。新 stage 在该位置插入,带预先选择的 operator。Stage 编辑器打开,带准备填写的代码片段。
搜索
面板顶部的搜索框按 operator 名称或描述文本过滤 cards。键入 "lookup" 查找 $lookup 和 $graphLookup。键入 "geo" 查找 $geoNear。键入 "window" 查找 $setWindowFields。
覆盖的内容
完整的 MongoDB aggregation stage 目录(~40 个 operators):
$match·$project·$group·$sort·$limit·$skip$lookup·$graphLookup·$unwind·$addFields·$set·$unset$bucket·$bucketAuto·$facet·$count·$sample$out·$merge·$redact·$replaceRoot·$replaceWith$search·$vectorSearch·$geoNear·$densify·$fill$unionWith·$setWindowFields·$sortByCount·$indexStats·$collStats