Make a script to create MongoDB collections from Mongo shell?
问题 Could you please help me out in writing Mongo Shell script to create new collections and indexes to it. Here are some part of the code which i wrote and i need to refactored it. db.createCollection("Dog", { autoIndexId : true}); db.createCollection("Cat", { autoIndexId : true}); db.createCollection("Mouse", { autoIndexId : true}); db.createCollection("Name", { autoIndexId : true}); In above code can i write single statement to create multiple collections? and also add multiple indexes to one