Mongo Collections Tutorials

MongoDB Delete Collection

In this post, We will learn How to delete a collection from MongoDB.MongoDB shell command `db.collection.drop()` is used to drop the specified collection from the selected DB. Also, It will remove all the documents and indexes associated with the dropped collection.Syntax:db.collection_name.drop()Drop Query Response:It will return `true` when successfully drops a collection. It will return `false` when collection to drop does not exist.Create Collection:First, We will create a topics3 collection in […]... Read More »

MongoDB Create Collection

In this post, We will learn How to create a collection in MongoDB.MongoDB is stored in the format of documents and Documents are stored in the collection. Collections are stored in the database. Collections is a group of MongoDB documents like a table.MONGO DATABASE > COLLECTIONS > DOCUMENTSWe can create collections in two ways.Method 1:Using `createCollection()` method, We can create a collection in mongo database.Syntax:db.createCollection(name, options)In this shell command.`name` is […]... Read More »