
- MongoDB Tutorial
- MongoDB - Home
- MongoDB - Overview
- MongoDB - Advantages
- MongoDB - Environment
- MongoDB - Data Modeling
- MongoDB - Create Database
- MongoDB - Drop Database
- MongoDB - Create Collection
- MongoDB - Drop Collection
- MongoDB - Data Types
- MongoDB - Insert Document
- MongoDB - Query Document
- MongoDB - Update Document
- MongoDB - Delete Document
- MongoDB - Projection
- MongoDB - Limiting Records
- MongoDB - Sorting Records
- MongoDB - Indexing
- MongoDB - Aggregation
- MongoDB - Replication
- MongoDB - Sharding
- MongoDB - Create Backup
- MongoDB - Deployment
- MongoDB - Java
- MongoDB - PHP
- Advanced MongoDB
- MongoDB - Relationships
- MongoDB - Database References
- MongoDB - Covered Queries
- MongoDB - Analyzing Queries
- MongoDB - Atomic Operations
- MongoDB - Advanced Indexing
- MongoDB - Indexing Limitations
- MongoDB - ObjectId
- MongoDB - Map Reduce
- MongoDB - Text Search
- MongoDB - Regular Expression
- Working with Rockmongo
- MongoDB - GridFS
- MongoDB - Capped Collections
- Auto-Increment Sequence
- MongoDB Useful Resources
- MongoDB - Questions and Answers
- MongoDB - Quick Guide
- MongoDB - Useful Resources
- MongoDB - Discussion
How to remove a MySQL collection named 'group'?
The group is a type of method in MongoDB. It shouldn’t be created as a collection name. Even if you created it, you can easily remove it using getCollection('group').drop();). Let us first create a collection with documents −
> db.createCollection('group'); { "ok" : 1 } > db.getCollection('group').insertOne({"StudentName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cb80fe9623186894665ae3c") } > db.getCollection('group').insertOne({"StudentName":"Robert"}); { "acknowledged" : true, "insertedId" : ObjectId("5cb80fef623186894665ae3d") }
Following is the query to display all documents from the collection with the help of find() method −
> db.getCollection('group').find().pretty();
This will produce the following output −
{ "_id" : ObjectId("5cb80fe9623186894665ae3c"), "StudentName" : "Chris" } { "_id" : ObjectId("5cb80fef623186894665ae3d"), "StudentName" : "Robert" }
Following is the query to remove the collection named ‘group’ −
> db.getCollection('group').drop();
This will produce the following output −
True
- Related Articles
- MongoDB: How to query a collection named “version”?
- How to remove names from a named vector in R?
- How to remove all elements from a Collection in another Collection
- How to remove duplicates from MongoDB Collection?
- MongoDB query to retrieve records from a collection named with letters and numbers
- MySQL group by for separate id without using GROUP BY to remove duplicate column row?
- Group by dates in a MongoDB collection?
- How to remove a member from the local group using PowerShell?
- MongoDB query to remove entire data from a collection
- How to remove a group of elements from a pandas series object?
- MySQL query error with a table named “order”?
- How to remove all documents from a collection except a single document in MongoDB?
- How to determine if a value appears in a GROUP BY group in MySQL?
- MongoDB query to remove entire array from collection?
- Use Iterator to remove an element from a Collection in Java

Advertisements