MongoDB CreateCollection

From mi-linux
Revision as of 23:43, 18 October 2016 by Cm1958 (talk | contribs)
Jump to navigationJump to search

Main Page >> MongoDB >>MongoDB Workbook >> Create Collections

Create a Collection

If a collection does not exist, MongoDB will automatically create the collection when you first store data for that collection.

You can, however, create one and set some options:

db.createCollection('deptCollection', {max: 20})

In this case we are going to limit our collection to hold a maximum of 20 documents.


Next Step

Inserting data into the collection