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版)
特殊的索引和集合类型
127
因此必须指定索引或者文档使用的语言。
text
索引允许指定
"default_language"
选项,其
默认值为
"english"
,可以被设置为多种其他语言。
例如,要创建一个法语索引,可以这样做:
> db.users.createIndex({"profil" : "text",
"intérêts" : "text"},
{"default_language" : "french"})
这样一来,除非另外指定,否则这个索引会默认使用法语的词干提取机制。可以在每个文
档的基础上使用
"language"
字段来描述文档的语言,从而指定另一种词干提取语言。
> db.users.insert({"username" : "swedishChef",
... "profile" : "Bork de bork", language : "swedish"})
6.3
 固定集合
MongoDB
中的“普通”集合是动态创建的,并且可以自动增长以容纳更多的数据。
MongoDB
中还有另一种集合
,名为
固定集合
,此集合需要提前创建好,而且它的大小是
固定的(参见图
6-3
)。
6-3:新文档被插入队列末尾
使用固定大小的集合引出了一个有趣的问题:当我们试图向一个已经满了的固定集合中插
入数据时会发生什么?答案是,固定集合的行为类似于循环队列:如果空间不足,那么最
旧的文档将被删除,新的文档将取而代之(参见图
6-4
。这意味着在插入新文档时,固定
集合会自动淘汰最旧的文档。
128
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