MongoDB: db.collection.drop() method
The db.collection.drop() method is used to removes the specified collection as well as removes any indexes associated with the dropped collection from the database.
db.collection.drop() takes no arguments and will produce an error if called with any arguments.
Example: MongoDB: db.collection.drop() method
Here is the collections in the test database
> show collections restaurants restaurants1 system.indexes user_new userdetails
The following statement will drop the collection user_new.
Here is the output.
Now show the collection list in the test database.
> show collections restaurants restaurants1 system.indexes userdetails
Retrieve the restaurants data from here
This method obtains a write lock on the affected database and will block other operations until it has completed.
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework