MongoDB installation and simple use

Source: Internet
Author: User
Tags findone
Installation 1. create a mongodb folder and a mongodb folder. 2. install mongodb is different from Install SQL. Install mongodb by executing the cmd command to execute the command. find binb in the file directory. deploy dbpath using an engine in the binfile

Installation 1. create a mongodb folder and a mongodb folder. 2. install mongodb is different from Install SQL. Install mongodb by executing the cmd command to execute the command. find the bin B in the file directory. deploy dbpath using an engine in the binfile

Install 1. Create a mongodb folder

Create a new mongodb folder, and create a data folder for mongodb as a database

2. Install mongodb

Unlike installing SQL, install mongodb by executing the cmd command.

Run the cmd command

A. Find the bin in the file directory.

B. Deploy it using an engine in the binfile

'Yi': Hunting 'fl, late condition. Training ull, L, DB: Broken nft mountains, households, n. Hey. [) R "n month Bu in: field. Ft server ,. Ming a, a Gong in ). Ongod two friends a d such as a seven Bu p: field. Protection t "a protection a field. ,. Shout for-"height =" 118 "src =" http://www.68idc.cn/help/uploads/allimg/150822/1026455M1-0.jpg "width =" 472 "/>

Dbpath is the address of our mongodb database.

D: \> cdd:, continent ongoDB from bin:, continent ongoDB spoon] in> nongod. Exe A dbpathd:, training ongoDB from dataedNar1216: 1: Day 2. 683 [initandlisten] NongoDBsta protection ting: pid =, daily 68Po protection t = 2? 1? DPath = d:, Zhou ongoDB from data "4 A bithost = lenouo A PCedHar1216: 1: Day 2. 685 [initandlisten] dbue protection sionuZ. 4. 9edHar1216: 1: 2. 686 [initandlisten] gitue protection sion: 52fe, d21959e32asbdbempo, 5db1_e4e, 29cedNar1216: 1: 2. 68? [Initandlisten] buildinfo: Discuss indo for 55s s. Get "indo discuss with sue 510 <. Ajor = 6, ninor = 1, build =? 6, 1, platforn = 2, seruice a pack = 'seruicepackl '> B00STLIB a uersion = 1 A bow 9edHar1216: 1: Day 2. [Initandlisten] allocato protection: s evening stenedHar1216: 1: Day 2. 692 [initandlisten] options :( dbpath: "d: larongodb shout ata") edNar1216: 1: Day 2. 733 [initandlisten] journaldir = d:, continent ongoDB ata \ jou protection naledNar1216: 1: Day 2. 733 [initandlisten] protected ecoue protection: nojou protected nalfilesp protected esent, not, cove protected neededhar1216: 1: Day 2. [Initandlisten] "aitingfo onsonpo t27: 17edHar1216: 1: 3. [Uebsvr] adnin discuss ebconsole discuss aitingfo rugged connectionsonpot28 1,:} Old ,., l "height =" 376 "src =" http://www.68idc.cn/help/uploads/allimg/150822/1026454349-1.jpg "width =" 576 "/>

The installation is successful.

Default 27017 Port

Enter localhost: 27017 in the browser.

You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
We can see that this statement proves that mongodb is successfully installed. 3. Set window environment variables

The path of the execution file in the extracted binfile is directly placed in the environment variable, so that we can directly access all the programs through cmd.

4. bat file

Start mongodb Service

My batch files: http://pan.baidu.com/s/1i3ql7bZ

Simple use 1. Create a database

Use [databaseName]

This is only a database cache pool. If you leave this empty database, it will be deleted.

2. view all databases

Show dbs

3. Add a set to the specified database and add records

Usetestcfls "itc Bu edtodbtestcfl> db. Pe guard son. Inse protection t <{naoe: "cfl"> sho matches the dbslocal day. ? 8125GBtestcfl. 2. Create a database, and insert data ~ Show Database "height =" 107 "src =" http://www.68idc.cn/help/uploads/allimg/150822/1026453022-3.jpg "width =" 518 "/>

4. view all documents in the database

Show collections

5. Update document data

Db. person. update ({name: "clm" },{ $ set: {name: "czs "}})

, "Naoe": Ding "one id", objectld <"532.442e8f3f, a6dl ?? 2454a ">," na "e" '> db. Pe guard son. Findone <> Public edHar121,: 26: 3. 331T Xi PeFrror: ProPert Xi 'findone' of5notafunction> db. Person. Update ( , 'Cfl "}, 'cl ."} Objecttestcfl. Pe protects 'ondb. Person. Find (), '_ id ": objectld <" 532 212e8f3f9a6dl ?? 24549 ")," naoe ":" cfl "}, '_ id": objectld <"532 442e8f3f9a6dl ?? 2454a ")," naoe ":" cZs "}" height = "149" src = "http://www.68idc.cn/help/uploads/allimg/150822/1026455359-4.jpg" width = "576"/>

, Db. Person. Update , '_ Id ": objectld <" 532, 212e8f3f, a6d17? 24549 ")," _ ld ''. Objoctld <"532 442e8f3f9a6d17? 2454a "), 'nane": ', c25 "} flew, 'nane": "cflchange", 'nane ": "czschange" "height =" 157 "src =" http://www.68idc.cn/help/uploads/allimg/150822/102645A93-5.jpg "width =" 576 "/>

6. delete a set in the database

Db. [document]. drop ()

7. delete a database

Db. dropdatabase

8. help displays all database operations 9. Database and set command Specifications 10. mongoDB shell built-in js engine can directly execute j code

Summary

The above is a rough understanding of mongodb, and you need to contact the specific instance for specific use.

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.