Create and Drop MongoDB Collections

Learn and practice commands to create and drop a MongoDB collection.

Create a collection

MongoDB implicitly creates a collection when a record is inserted or referenced in command for the first time. The implicit creation of a collection uses the default options.

We use the following command to create a collection.

db.createCollection(<name>, <options>);

Get hands-on with 1200+ tech skills courses.