First of all go to https://www.mongodb.org/ official website Download Oh ~ My is 64 bit of
The installation is simple to say ... Download an installation package and install it as soon as you find ...
CMD in your installation directory under the/bin folder ... Very simple and ...
1. Locate the "MongoDB" path and run the Mongod Open command while using--dbpath to specify the data storage location as "DB" folder
D:\mongodb\server\bin>Mongod--dbpath=d:\mongodb\data
2015-07-07t23:43:19.739+0800 I CONTROL Hotfix KB2731284 or later update is not installed, would zero-out data files
2015-07-07t23:43:19.801+0800 I JOURNAL [Initandlisten] JOURNAL dir=d:\mongodb\data\journal
2015-07-07t23:43:19.802+0800 I JOURNAL [initandlisten] recover:no JOURNAL files present, no recovery needed
2015-07-07t23:43:19.837+0800 I JOURNAL [durability] durability thread started
2015-07-07t23:43:19.837+0800 I JOURNAL [JOURNAL writer] JOURNAL writer thread started
2015-07-07t23:43:19.842+0800 I CONTROL [Initandlisten] MongoDB starting:pid=6564 port=27017 dbpath=d:\mongodb\data 64- Bit Host=toolo
2015-07-07t23:43:19.842+0800 I CONTROL [Initandlisten] targetminos:windows 7/windows Server R2
2015-07-07t23:43:19.842+0800 I CONTROL [initandlisten] DB version v3.0.4
2015-07-07t23:43:19.843+0800 I CONTROL [Initandlisten] git version:0481c958daeb2969800511e7475dc66986fa9ed5
2015-07-07t23:43:19.878+0800 I CONTROL [Initandlisten] OpenSSL Version:openssl 1.0.1m-fips Mar 2015
2015-07-07t23:43:19.878+0800 I CONTROL [Initandlisten] Build info:windows sys.getwindowsversion (major=6, Minor=1, build=7601, platform=2, service_pack= ' Service Pack 1 ') boost_lib_version=1_49
2015-07-07t23:43:19.879+0800 I CONTROL [Initandlisten] Allocator:tcmalloc
2015-07-07t23:43:19.879+0800 I CONTROL [Initandlisten] options: {storage: {dbPath: ' D:\MongoDB\data '}}
2015-07-07t23:43:19.881+0800 I INDEX [Initandlisten] allocating new ns file D:\MongoDB\data\local.ns, filling with zeroes ...
2015-07-07t23:43:20.136+0800 I STORAGE [fileallocator] Allocating new datafile D:\MongoDB\data\local.0, filling with Zeroes ...
2015-07-07t23:43:20.136+0800 I STORAGE [fileallocator] Creating directory D:\MongoDB\data\_tmp
2015-07-07t23:43:20.425+0800 I STORAGE [fileallocator] Done allocating datafile D:\MongoDB\data\local.0, SIZE:64MB, Took 0.286 secs
2015-07-07t23:43:20.536+0800 I NETWORK [Initandlisten] waiting for connections on port 27017
2. Open a CMD window and go to the bin directory ...
D:\mongodb\server\bin>MONGO
2015-07-07t23:58:30.882+0800 I CONTROL Hotfix KB2731284 or later update is not installed, would zero-out data files
MongoDB Shell version:3.0.4
Connecting To:test
Enter test database by default
3. Insert data:
>db. Person.insert ({"Name": "Helloword", "Age": ""} ");
Writeresult ({"ninserted": 1})
prompt for Insert success!
4. Querying Data
4.1 All Queries
>db. Person.find ();
{"_id": ObjectId ("559bf7cb15c09e490e77d072"), "name": "Feiazi", "Age": "22"}
{"_id": ObjectId ("559bf7da15c09e490e77d073"), "name": "Helloword", "Age": "23"}
{"_id": ObjectId ("559bf7fa15c09e490e77d074"), "name": "Luojun", "Age": "22"}
4.2 Item Query
>db. Person.find ({"Name": "Luojun"});
{"_id": ObjectId ("559bf7fa15c09e490e77d074"), "name": "Luojun", "Age": "22"}
PS: It is recommended to configure the PATH environment variable of the system, so that you do not need to cmd into the MongoDB installation directory of the bin folder every time ...
Late at night, I slept ... Like to study together, you can pay attention to Oh!
Source: http://www.cnblogs.com/huangxincheng/archive/2012/02/18/2356595.html
Thank you for sharing, let me learn a lot ....
MongoDB Learning Journey (i)