原文链接:https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/

管道聚合

$project Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document.

修改文件的输入或输出流,例如增加新的字段,或者删除已存在的字段。

$match  Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match).

过滤文件流,但不改变文件流中的字段。

$redact Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents.

The argument can be any valid expression as long as it resolves to $$DESCEND$$PRUNE, or $$KEEP system variables. For more information on expressions, see Expressions.

支持表达式方式的过滤,很重要的功能。

$limit  Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents).

限制传入到下一个阶段的字段个数。

$skip  Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first ndocuments).

$unwind Deconstructs an array field from the input documents to output a document for eachelement. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.

对某个字段组进行分组,分成多个元素。

$group Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields.

根据group分组的表达形式,对于输入的字段进行处理,并规定的group的组的规则输出。

$sort  Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document.

$geoNear Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match$sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field.

$lookup Performs a left outer join to another collection in the same database to filter in documents from the “joined” collection for processing.

$out  Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline.

$indexStats Returns statistics regarding the use of each index for the collection.

mongoDB之Pipeline Aggregation Stages的更多相关文章

  1. 使用Mongo进行分页

    MongoDB’s pipeline aggregation is – like most things in application development these days – confusi ...

  2. aggregation 详解4(pipeline aggregations)

    概述 管道聚合处理的对象是其它聚合的输出(桶或者桶的某些权值),而不是直接针对文档. 管道聚合的作用是为输出增加一些有用信息. 管道聚合大致分为两类: parent 此类聚合的"输入&quo ...

  3. 疯狂了!当游戏爱上MongoDB会怎么样???

    导读 前端时间魔兽这个电影我相信大家都看过了哈,作为一个码农,有时候我也会去思考魔兽世界这个游戏背后他的一些设计和实现,比如他用什么数据库.当然真正用什么数据库这个我是不确定的,我们今天的主题是当游戏 ...

  4. MySQL vs. MongoDB: Choosing a Data Management Solution

    原文地址:http://www.javacodegeeks.com/2015/07/mysql-vs-mongodb.html 1. Introduction It would be fair to ...

  5. MongoDB学习之路(五)

    MongoDB $type 操作符 类型 数字 备注 Double 1 String 2 Object 3 Array 4 Binary data 5 Undefined 6 已废弃 Object i ...

  6. mongodb与sql聚合对应图 M

    mongodb与sql聚合对应图 M - CSDN博客 http://blog.csdn.net/u011930016/article/details/49422425 SQL Terms, Func ...

  7. 零售行业下MongoDB在产品目录系统、库存系统、个性推荐系统中的应用【转载】

    Retail Reference Architecture Part 1: Building a Flexible, Searchable, Low-Latency Product Catalog P ...

  8. 关于aggregation 语法和表达式大全(最新3.4版)

    用mongodb四年多了,从1.8版用到目前的3.4版,功能越来越强大,而且它的每一次升级带给我的都是惊喜,最近发现他的aggregation(管道)技术越来越丰富了,基本上将它提供的所有功能都集成了 ...

  9. MongoDB中的数据聚合工具Aggregate和Group

    周煦辰 2016-01-16 来说说MongoDB中的数据聚合工具. Aggregate是MongoDB提供的众多工具中的比较重要的一个,类似于SQL语句中的GROUP BY.聚合工具可以让开发人员直 ...

随机推荐

  1. windows 下用eclipse搭建java、python开发环境

    本人只针对小白!本文只针对小白!本文只针对小白! 最近闲来无事,加上之前虽没有做过eclipse上java.python的开发工作,但一直想尝试一下.于是边查找资料边试验,花了一天时间在自己的机器上用 ...

  2. 最后一次PSP

    PSP: 一.计划 完成这个任务需要五天左右. 二.开发 1.需求分析: 作为一个排球比赛的现场工作人员,我需要统计每一名球员的得分以及技术统计(如:发球,拦网,一传等等),以便于颁发每场比赛的MVP ...

  3. Objective-C如何对内存管理的?

    Objective-C的内存管理主要有三种方式ARC(自动内存计数).手动内存计数.内存池. 1. (Garbage Collection)自动内存计数:这种方式和java类似,在你的程序的执行过程中 ...

  4. 关于w3school的html5部分output 元素实例代码(点亲自试一试进去)的问题纠正

    修复: 将原来的 =  号修改成 <input type="button" onclick="resCalc()" value ="=" ...

  5. java并发编程学习笔记(一)初识并发原子性

    1.并发的意义 现在是一个多核的时代,并发的存在意义就是为了能够充分利用多核计算机的优势,提高程序的运行效率: 2.并发的风险 竞争-----多个线程对内存数据数据进行读写操作时,对数据处理结果的一个 ...

  6. Maven指令

    mvn clean compile  //clean告诉Maven清理输出目录target/,compile告诉Maven编译项目主代码. mvn clean test  //清理输出目录target ...

  7. re.S

    在Python的正则表达式中,有一个参数为re.S.它表示多行匹配

  8. CSS 中 Font-Family 中英文对照表

    在 CSS 中,我们经常会使用 Font-Family 属性来定义字体.其中,中文字体如果直接使用中文名称,很有可能在非中文的系统环境下造成字体异常.所以通常使用字体的英文名称定义 Font-Fami ...

  9. 【转】我是如何在SQLServer中处理每天四亿三千万记录的

    原文转自:http://blog.jobbole.com/80395/ 首先声明,我只是个程序员,不是专业的DBA,以下这篇文章是从一个问题的解决过程去写的,而不是一开始就给大家一个正确的结果,如果文 ...

  10. NueGet设置package Source

    package Source为:http://packages.nuget.org/v1/FeedService.svc/ 最新的地址(2015-4-10):https://www.nuget.org ...