createCollection()

Creates a new collection where data will be stored

Example

db.createCollection("users").then(() => {
    console.log("createCollection:", "ok");
}).catch((error) => {
    console.log("error:", error);
});

createCollection(name)

ParameterDescription

name

String The name for the collection

Last updated