Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create multiple collections in mongodb

#You can make a list of collection names and then loop through it 
and call db.createCollection operations on mongo shell easily:

> var collectionList = ["A", "B"];
> collectionList.forEach(function(collectionName) {db.createCollection(collectionName)})
 
PREVIOUS NEXT
Tagged: #create #multiple #collections #mongodb
ADD COMMENT
Topic
Name
3+2 =