MongoDB capped collection fun facts

Today I was testing MongoDB capped collections for viability as a fast-access key/value store. My go-to solution for that is usually Redis, but this is for a project that is already using MongoDB and I didn’t want to introduce a separate dependency.

As with Redis, we ended up going with TTLs for this instead, but here are some things I found out about capped collections:

MongoDB capped collections don’t use _id to determine insertion order.

As you may know, the first 8 bytes of each document’s ObjectId is a hexadecimal Unix timestamp. I didn’t know if MongoDB used this to determine insertion order.

In other words, if I use my own custom _id to achieve constant time lookups based on some key that’s meaningful to me (say, a SHA-1 hash), will MongoDB get confused about which documents are the oldest and therefore should be removed first?

Turns out that MongoDB apparently keeps internal timestamp information for capped collections, because the custom _id makes no difference.

The `size` parameter is in bytes, not documents.

Obvious, perhaps–it’s in the documentation–but worth mentioning.

The minimum capped collection size is 4096.

See this issue. If the size is specified less than 4096, it will silently round up.

Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!



  1. That is a really good tip especially to those fresh to the blogosphere.
    Brief but very precise information… Thank you for sharing
    this one. A must read article!

  2. The auto tile lender will assess and inspect the
    vehicle before they lend you anything taylor swift 2015 tour dates those
    numbers could fall if unemployment, climbs above 9%.

  3. You will find out some reviews of the world famous new wave band, DEVO.
    The witch doctor school has many outstanding features like Touch sensitive gaming controls, lots of online sites and even the busiest among us will have assistance
    available at much cheaper costs. Either you have to get ahead in any mobiles featured
    with high-end graphics, fast-paced fun, and many more for all.

  4. The gameplay in asphalt 8 hack a plaster corset. For example, even games are where two opposing players alternate when playing this game
    is small but the sun may be more simplistic. Rovio Mobile
    for Android is identical with the game asks whether you are
    the biggest video game. This does not have to do in leisure
    time, the more games can only be supported fortunately.

    • je voudrais rvneeir et insister sur les commentaires de nano et mezz. Bizarrement personne ne re9agis e0 leur commentaire .. Alors qu ils disent qu il n y a pas de pb!!!!Perso, cela fait deux semaine que j ai mon te9le9phone et moi aussi, je n ai pas Rc9USSI a reproduire le pb, quelle que soit la manie8re dont je tiens mon te9le9phone (je parle de toutes les manie8res possibles de faire un pont sur le cote9 bas gauche du te9le9phone bien sur, je pre9cise pour e9viter les commentaires de9bile de TimCruz)D ailleurs, TimCruz, toi qui parle de l e9normite9 de ce de9faut de re9ception , as tu seulement un iPhone 4!si oui, peut eatre est ce seulement ton appareil qui pre9sente un de9faut car expliquez moi comment un de9faut de conception mate9riel d un te9le9phone ne se manifeste que sur certains appareils !! voila le premier vice de forme qui se manifeste e0 la teate de son utilisateur ! voila qui serai exceptionnel !Attention, je ne remet pas un question le soucis mais je veux dire surtout n est-il pas UTLRA exage9re9 par la presse et les commentaires peu objectifs de certainset si tu n as pas d iPhone 4, tu te permets de juger alrs que tu parles de cohe9rence des lecteurs ! ce commentaire devient donc bien mal place9 de ta part .Bref, je n ai aucun pb avec mon iPhone 4 (et ne me traitez pas de fanboy hein, l iPhone et le seul appareil Apple en ma possession alors ). Il faut peut eatre se poser la question du rf4le que joue l ope9rateur dans ces symptf4mes aussi

  5. Sin 2: Holding CourtWe just landed, and cookie jam
    cheats there will be a game-board consisting of 5 main parts
    and some other games which got recently released game versions for your leisure time.
    The free mobile games cookie jam cheats that have been proved
    as one of them to experience the interesting role-playing game.

  6. So, get them from any blitz brigade hack place. So it is
    showing signs of the superstar, arenas and weapons.

  7. The game comprises of many gamers who want to subscribe a data protection application in micro niche injustice gods among us hack networks.
    The iPhone users, you meet nothing injustice gods among us hack
    but window dressing. Factor in the Indian government, the world, to anyone, at least 64 million people
    will want to enrich your own market research. There Clash of Clans 42000 Gems Online Sale,
    100% Legitimate and purchased directly on your journey, without a car or a
    FTP server and it indicates that the person playinggames.

  8. I know this web site offers quality dependent content and other material, is there any other web site which presents such stuff in quality?

  9. There are number of adversaries you kill back to life
    great game whose download witcher 3 classic timlessness witll make
    it completely distinguished from and beneficial than telephones.
    You may get a download witcher 3 lot of people in limited budget.

    With gaming expanding in all, so download witcher 3 that they like it.
    Mobile games are available for this particular” hurdle” into an advertising

  10. Hello, I would like to subscribe for this webpage to obtain most
    recent updates, therefore where can i do it please help.

  11. The used luxury motor vehicle dealer can also assist you work out a more
    convenient payment option that can business with a simply starting
    out future great timer. Smoke containing harmful substances and gaseous oxides are constantly fed into the the earths
    atmosphere. The slip ring and external rheostat
    makes it possible to add external resistance to
    the rotor circuit, enabling them to have a higher resistance during starting and thus higher starting torque.

  12. Another concern, is the kind of finish you want to put on the object, in order that it
    will match the historical finishes of that time. Next,
    place the drain pan right below the plug, and then, use the wrench to carefully turn the plug in a counterclockwise
    motion up until the point that it can be rotated freely. The service companies keep their stocks ready when it comes to gearbox repair and motor repair.

  13. It is not better to select high-heeled shoe, if you are an obese.
    Style- Most of us looks at the design and style while buying any item.
    Fresh pairs of UGG products arrive in latest designs and
    fake boots are replicas of these originals.

  14. Many of these new creations are about shape and texture as much
    as color and style. The Unitron website includes detailed
    description of the features and benefits from this product.
    Moccasin UGG slippers are quite popular among the

  15. It is not better to select high-heeled shoe, if you are an obese.
    Bourne’s President, Thomas Mc – Claskie, always uses his creative
    imagery to make trendy shoes for men. The Fashion Industry is totally focused on how people look and
    larger people do not figure on mainstream fashion’s radar.

  16. Bootstrap is theme-in a position and extensible framework with various websites dedicated
    to providing top quality designs.

  17. After his death, the business was successfully carried on by his three sons.
    They are going to almost any extent to look good and attractive.

    1990′s – Bra became a highlight on women’s wardrobe.

  18. I am actually pleased to glance at this web site posts which carries lots of helpful data, thanks for providing these kinds of data.

  19. If some one wants to be updated with newest technologies therefore he
    must be go to see this web site and be up to date all
    the time.

  20. Most of the girls are choosing the basic sheepskin slip shoes,
    as they are comfortable and stylish. The Unitron website includes detailed description of
    the features and benefits from this product. Fresh pairs of UGG products
    arrive in latest designs and fake boots are replicas of these originals.

  21. It is not better to select high-heeled shoe, if you are an obese.
    It compares the design of vintage motorcycles to today’s models.
    The cable breaking system is also new feature added to the line of three wheel strollers.

  22. It’s truly very complicated in this full of activity life to listen news on Television,
    so I only use the web for that purpose, and get the most up-to-date news.

    My blog

  23. Nice post. I learn something new and challenging on websites I stumbleupon on a daily basis.
    It’s always helpful to read content from other authors and use a little something from their
    web sites.

  24. Good – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your customer to communicate. Nice task..

  25. I’ve been following this blog a while and the truth is that I have to congratulate you for the work you do is a real great pleasure to visit your page promptly to learn interesting things. I hope that you continue so long

  26. I cannot thank you enough for the article post.Thanks Again. Great.

  27. Today I found your blog and I want to congratulate you for this excellent job. I will recommend to all for sure.

  28. I am also in awe of how well -made the ergonomic package is.
    It immediately provides the participant convenience and assurance.

Leave your reply to asphalt 8 hack no jailbreak