MONGO Simple operation

Source: Internet
Author: User

  1. Use admin #进入数据库admin

  2. Db.adduser (' name ', ' pwd ') #增加或修改用户密码

  3. Db.system.users.find () #查看用户列表

  4. Db.auth (' name ', ' pwd ') #用户认证

  5. Db.removeuser (' name ') #删除用户

  6. Show Users #查看所有用户

  7. Show DBS #查看所有数据库

  8. Show Collections #查看所有的collection

  9. Db.printcollectionstats () #查看各collection的状态

  10. Db.printreplicationinfo () #查看主从复制状态

  11. Db.repairdatabase () #修复数据库

  12. Db.setprofilinglevel (1) #设置记录profiling, 0=off 1=slow 2=all

  13. Show Profile #查看profiling

  14. Db.copydatabase (' mail_addr ', ' mail_addr_tmp ') #拷贝数据库

  15. Db.mail_addr.drop () #删除collection

  16. Db.dropdatabase () #删除当前的数据库


MONGO Simple operation

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.