Difference between revisions of "MongoDB CreateComplexCollection"
From mi-linux
Jump to navigationJump to searchLine 29: | Line 29: | ||
== Next Step == | == Next Step == | ||
− | [[MongoDB_InsertNestedData|Inserting]] data into the collection | + | [[MongoDB_InsertNestedData|Inserting]] nested data into the collection |
Latest revision as of 10:16, 11 November 2017
Main Page >> MongoDB >>MongoDB Workbook >> Create Complex Collection
Create a Collection
This time we will create a collection in advance and add some nested documents to it.
Check what collections you have already:
show collections
Now create a new one called deptCollection 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.
This command should return:
db.createCollection('deptCollection', {max: 20}) { "ok" : 1 }
To check this has been created:
show collections
Next Step
Inserting nested data into the collection