Getting Started with MongoDB

Source: Internet
Author: User

# # #安装
1. Install (Windows): Unzip to install directory C:\mongodb, create folder C:\mongodb\data\db, C:\mongodb\data\log, create file c:\mongodb\data\log\ MongoDB.log
2. Start-Up service: CD C:\mongodb\bin; Mongod-dbpath "C:\mongodb\data\db"
3. Test Connection: C:\mongodb\bin\mongo
# # #常用命令
Show DBS//Show Database list
Use dbname//Enter dbname database, no then create
DB//view current database name
Exit//Sign Out
Show Collections//Display the collection in the Database (table)
Db.dropdatabase ()//delete current database
Db.mytable.drop (); Delete Table MyTable
Db.mytab.save ({"Name": "AAA"})//CREATE table Mytab and add a record
Db.mytab.insert ({"Name": "BBB", "Age": 10})//Insert Record
Db.mytab.remove ({"Name": "AAA"})//delete record
Db.mytab.find ()//Find all records
Db.mytab.findOne ()//Find first record
Db.mytab.update ({"Name": "AAA"},{"name": "CCC", "Age": 22}); Update record

Getting Started with MongoDB

Related Article

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.