... "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.
O’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
I 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
I’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
I'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.