Query all database showdbs; Switch to create database usemydb; display all database collections showcollections query the list of database names contained in the specified database db. getCollectionNames () deletes the database currently in use. dropDatabase (); view the database currently in use. getName (); db displays the current db status
Query all database show dbs; Switch to/create database use mydb; display all database collections show collections query the list of database names contained in the specified database db. getCollectionNames () deletes the database currently in use. dropDatabase (); view the database currently in use. getName (); db displays the current db status
Query all database show dbs; Switch to/create database use mydb; display all database collections show collections query the list of database names contained in the specified database db. getCollectionNames () deletes the database currently in use. dropDatabase (); view the database currently in use. getName (); db displays the current db status db. stats (); current DB version db. version (); view the connection address of the current db. getMongo (); Help command prompt help db. help (); db. yourColl. help (); db. youColl. find (). help (); rs. help (); clone the database db from the specified host. cloneDatabase ("127.0.0.1 ");?? Clone the database data on the specified machine to the current database and copy the data from the specified machine to a database. copyDatabase ("mydb", "temp", "127.0.0.1 ″);? Copy the mydb data of the local machine to the temp database to repair the current database db. repairDatabase (); view the database server status db. serverStatus ()? Queries the currently available storage space of the specified database set> use mydb;> db. userinfo. storageSize (); query the storage space allocated by the specified database set> use mydb;> db. userinfo. totalSize (); view the basic information of the aggregation set 1. View help? Db. yourColl. help (); 2. query the number of data entries in the current set? [...]
Original article address: Mongodb Learning (operation): common operation commands. Thank you for sharing them with me.