Mongodb: Does the stats command show me the capped size setting?

Posted on

Question :

I am looking around my mongo instance. One of the collections was created as capped:

db.createCollection(“userObjects”, { capped:true, size:400000000000 })

But when I look at the db.userObjects.stats(), I don’t see any flag that indicates it is capped, or the cap size.

Am I missing something? (Is there another place to look?)

Answer :

If you connect to the proper DB and execute a db..stats() in the Mongo shell you will see “capped” : true third from the bottom of the output just after index sizes.

To figure out a collections cap size, you could use the system namespace.

e.g. db.system.namespaces.find({name : “.”}, {“options.size”:1})

Leave a Reply

Your email address will not be published. Required fields are marked *