Answers for "how to create collections in mongodb"

8

show collections in mongodb

db.getCollectionNames()
Posted by: Guest on June-08-2020
6

mongodb create collection

db.createCollection( <name>,
   {
     capped: <boolean>,
     autoIndexId: <boolean>,
     size: <number>,
     max: <number>,
     storageEngine: <document>,
     validator: <document>,
     validationLevel: <string>,
     validationAction: <string>,
     indexOptionDefaults: <document>,
     viewOn: <string>,              // Added in MongoDB 3.4
     pipeline: <pipeline>,          // Added in MongoDB 3.4
     collation: <document>,         // Added in MongoDB 3.4
     writeConcern: <document>
   }
)
Posted by: Guest on October-30-2020

Code answers related to "how to create collections in mongodb"

Browse Popular Code Answers by Language