Skip to Content
MongoDB权威指南(第3版)
book

MongoDB权威指南(第3版)

by Shannon Bradshaw, Eoin Brazil, Kristina Chodorow
November 2021
Intermediate to advanced
410 pages
12h 1m
Chinese
Posts & Telecom Press
Content preview from MongoDB权威指南(第3版)
140
7
再次回顾一下此管道。这个管道有
5
个阶段。首先,过滤
companies
集合,只寻找
"founded_year"
2004
的文档。然后,根据名称升序排列,跳过前
10
个匹配项,并将最
终结果限制为
5
。最后,将这
5
个文档传递到投射阶段,在这个阶段会重新调整文档形
状,使输出的文档只包含公司名称。
这里介绍了如何使用你已经熟悉的操作所形成的阶段来构建管道。聚合框架提供了这些操
作,它们对于后文讨论的阶段所要完成的分析类型是必要的。接下来,本章会深入讲解聚
合框架所提供的其他操作。
7.3
 表达式
随着对聚合框架的深入讨论,在构建聚合管道时,了解可以使用的不同类型的表达式是很
重要的。聚合框架支持许多表达式类型。
布尔
表达式允许使用
AND
OR
NOT
集合
表达式允许将数组作为集合来处理。特别地,可以取两个或多个集合的交集或并集,
也可以取两个集合的差值并执行一些其他的集合运算。
比较
表达式能够表达许多不同类型的范围过滤器。
算术
表达式能够计算上限(
ceil
ing
)、下限(
floor
)、自然对数和对数,以及执行简单的
算术运算,比如乘法、除法、加法和减法。甚至可以执行更复杂的运算,比如计算值的
平方根。
字符串
表达式允许连接、查找子字符串,以及执行与大小写和文本搜索相关的操作。
数组
表达式为操作数组提供了强大的功能,包括过滤数组元素、对数组进行分割或从特
定数组中获取某一个范围的值。
变量
表达式在本书中不会深入研究,这类表达式允许处理文字、解析日期值及条件表
达式。
累加器
提供了计算总和、描述性统计和许多其他类型值的能力。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Spark快速大数据分析(第2版)

Spark快速大数据分析(第2版)

Jules S. Damji, Brooke Wenig, Tathagata Das, Denny Lee
Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty

Publisher Resources

ISBN: 9787115576538