In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Fixed set
MongoDB fixed set (Capped Collections) is a collection with excellent performance and fixed size. For a fixed size, we can imagine that it is like a circular queue. When the set space is used up, the inserted element will cover the original header element!
Features: you can insert and update, but the update cannot exceed the size of the collection, otherwise the update fails and deletion is not allowed, but you can call drop () to delete all rows in the collection, but you need to explicitly rebuild the collection after drop.
Back to the top.
Example
> db.createCollection (, {capped:, size:, max:: > > db.del_col2.insert ({x:: > db.del_col2.insert ({y:: > db.del_col2.insert ({z:: > db.del_col2.insert ({m:: > db.del_col2. : ObjectId (),:: ObjectId (),: > db.del_col2.insert ({n:: > db.del_col2. ObjectId (),:: ObjectId (),: >: >
Convert to a fixed set
> db.col2.find () {"_ id": ObjectId ("56c6cfd164799370c0ef35a2"), "x": 1} {"_ id": ObjectId ("56c6cfd664799370c0ef35a3"), "y": 2} {"_ id": ObjectId ("56c6cfdf64799370c0ef35a4"), "z": 3} > db.col2.isCapped () false > db.runCommand ({"convertToCapped": "col2", size:1000}) {"ok": 1} > db.col2.isCapped () true
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.