createCollection Command

Use the createCollection command to create a collection explicitly. Often this is used to declare Capped Collections.

> // mongo shell
> db.createCollection("mycoll", {capped:true, size:100000}) // Size is in bytes
> show collections

Most drivers also have a create collection helper method. You can manually issue any command also.

> db.runCommand( {create:"mycoll", capped:true, size:100000} )

Follow @mongodb

MongoDB Pittsburgh - May 15
MongoNYC - May 23
MongoDB Paris - Jun 14
MongoDB UK - Jun 20
MongoDC - June 26


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.

blog comments powered by Disqus