Common MongoDB operations-databases, mongodb-Databases
1. view all databases and run the show dbs command.
2. view the current database and use the command db
3. view all the collections in the current database, and run the show collections command or show tables command.
4. Create a database and use the command use database name, for example, use mydb1.
The name of the database followed by the use command. If the database exists, it is created if it does not exist. Therefore, this method is called implicit creation.
Note: After you use the command use mydb1 to create a database, the corresponding data file is not actually generated. If you exit at this time, the database will be deleted. Only after you create a collection in this database, to generate a data file.
5. Delete the current database and run the database. dropDatabase () command ()