植臻

谦虚、热情、简单、极致

Create a Limited Size Collection

| Comments

we create a collection with limited size 100000:

> db.createCollection("colcase1", {capped:true, size:100000})
{ "ok" : 1 }
> show collections
colcase
colcase1
system.indexes
>

and, we can convert a exist collection to a limited one:

> db.colcase.isCapped()
false
> db.runCommand({"convertToCapped":"colcase",size:100000})
{ "ok" : 1 }
> db.colcase.isCapped()
true
>

Look ! we did it

unload a picture:

Comments