Like this:
mongo <dbname> --eval "db.dropDatabase()"
More info on scripting the shell from the command line here: https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/#scripting
Related Contents:
- Find document with array that contains a specific value
- Add new field to every document in a MongoDB collection
- How to analyze disk usage of a Docker container
- What are naming conventions for MongoDB?
- MongoDB: How to find the exact version of installed MongoDB
- MongoDB: How to update multiple documents with a single command?
- When should I use a NoSQL database instead of a relational database? Is it okay to use both on the same site?
- Mongoose’s find method with $or condition does not work properly
- mongoDB/mongoose: unique if not null
- How does MongoDB sort records when no sort order is specified?
- What’s the $unwind operator in MongoDB?
- Why does direction of index matter in MongoDB?
- How to update a mongo record using Rogue with MongoCaseClassField when case class contains a scala Enumeration
- Using UUIDs instead of ObjectIDs in MongoDB
- Failed to start mongod.service: Unit mongod.service not found
- How to replace substring in mongodb document
- String field value length in mongoDB
- How to set a primary key in MongoDB?
- How to start a mongodb shell in docker container?
- What are the advantages of using a schema-free database like MongoDB compared to a relational database?
- MongoDB Full and Partial Text Search
- What security mechanisms does Meteor have? [closed]
- MongoDB “root” user
- How do I query for distinct values in Mongoose?
- MongoDB: Updating documents using data from the same document [duplicate]
- Importing json from file into mongodb using mongoimport
- Get a count of total documents with MongoDB when using limit
- To what extent are ‘lost data’ criticisms still valid of MongoDB?
- Using S3 as a database vs. database (e.g. MongoDB)
- MongoDB Find performance: single compound index VS two single field indexes
- MongoDB aggregate within daily grouping [duplicate]
- How do I copy a database from one MongoDB server to another?
- How to remove duplicates based on a key in Mongodb?
- Install ONLY mongo shell, not mongodb
- Group result by 15 minutes time interval in MongoDb
- mongodb status of index creation job
- How to update if exists otherwise insert new document?
- MongoDB – how to query for a nested item inside a collection?
- meteor: how can I backup my mongo database
- In MongoDB how do you use $set to update a nested value/embedded document?
- Using findOne in mongodb to get element with max id
- Adding/Subtracting days to ISODate in MongoDB Shell
- mongorestore command replace existing records?
- Difference between findOneAndDelete() and findOneAndRemove()
- How to delete system.profile collection from a MongoDB?
- Create Superuser in mongo
- How to connect to MongoDB running in Docker container?
- Check if every element in array matches condition
- How to insert a doc into mongodb using mongoose and get the generated id?
- mongodb difference remove() vs findOneAndDelete() vs deleteOne()