我正在使用 mongo 聚合框架,但我根本无法弄清楚一些术语。最特别的是,在某些示例中,参考 $project 处于“包含模式”。我还听说 _id 在相关上下文中被选择为“隐含”。谁能澄清一下?
http://docs.mongodb.org/manual/reference/aggregation/project/
db.article.aggregate(
{ $project : {
title : 1 ,
stats : {
pv : "$pageViews",
foo : "$other.foo",
dpv : { $add:["$pageViews", 10] }
}
}}
);
This projection includes the title field and places $project into “inclusive” mode. Then, it creates the stats documents with the following fields: