MongoDB (ii) installation and use

Source: Internet
Author: User

The installation and use of MongoDB

Recent projects need to be used to MongoDB, thus beginning to familiarize with NoSQL, with this article, documenting and facilitating others.

MongoDB Installation: Http://www.mongodb.org/downloads Here I choose Win32 Windows, download MSI format files to install directly Preliminary UseThe default installation location for 1.mongodb is located at: C:\Program FILES\MONGODB 2.6 Standard2. Add location to store data: Specify a folder for MongoDB to store mongodb data, here I create a C under C :/data/db3. Using the--dbpath parameter to set the location where the data is to start MongoDB, you need to run the Mongod.exe in the bin directory--dbpath=c:\data\ DB4. By default, Monggodb automatically assigns port ports, which is 270175. can now be accessed directly: 127.0.0.1:27017, the content that appears, proves that the client has started successfully Mongovue: http://www.xdowns.com/soft/38/110/2013/Soft_113291.html Add Connection parameter, default is test database, do not need user name and password basic Operation 1. Enter MongoDB's shell CD into the bin folder of MongoDB, enter: Mongo.exe, proof has entered the shell Command Window ~~2.insert Insert, find lookup, update update, remove delete Insert INSERT, insert data similar to JSON format
Db.person.insert ({id:1, "name": "Xiaoming"})
Find lookup, can be selected according to different fields, if no parameters will output all the data of person
Db.person.find follow the data in Dict to find the data
Db.person.find querying all data in a person
Update updates, you can change any field information, parameters include two parts, the first parameter is used to locate the modification, the second parameter is to modify the result
db.person.update Update Data
Remove Delete, count statistics number
Db.person.remove ({id:1, "name": "Xiaoming"})
Db.person.count ()
View data content in the client

MongoDB (ii) installation and use

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.