Mongodb Learning (operation): common operation commands

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.