Recently in the look at MongoDB, found really good, nosql type of database relative to the traditional MySQL, etc., because there are no many additional features, and it seems to be exceptionally useful. This feeling is the difference between JSON and XML, no XML is powerful, but lightweight enough to remove a lot of features that are seldom used, greatly improving performance. Great Location ~
It is also extremely convenient to use.
Download binaries from http://www.mongodb.org/downloads (or you can download the source code directly from the official GitHub, compared to the stable version that is directly binary, the development version has more new features, you can see the official documents directly).
It is simple to create a new folder Conf,data,log in the bin directory sibling of the download file.
Then create a new mongodb.conf file under the Conf folder with the following configuration file:
Port = 12345dbpath = Datalogpath = Log/mongod.logfork = True
Port is the port number that MongoDB starts, DBPath is the path that the data holds, LogPath is the file address that the log holds, the fork mark is a background thread (invalid under Windows)
Save all folders and configuration files, and then switch to the bin's parent folder on the command line.
Input:
./bin/mongod-f conf/mongodb.conf
So we started the MongoDB process, and now we're connected to it.
./bin/mongo 127.0.0.1:12345
Use list ~
> Show dbslocal 0.078GBtest 0.078gb> use testswitched to db test> Db.test_collection.insert ({x:1}) Writeresult ({"ninserted": 1}) > Db.test_collection.find ({x:1}) {"_id": ObjectId ("551FDC363AFE97CD9A55C8BC"), "X": 1}> db.test_collection.update ({x:1},{x:2}) Writeresult ({"nmatched": 1, "nupserted": 0, "nmodified": 1}) > Db.tes T_collection.find ({x:1}) > Db.test_collection.find ({x:2}) {"_id": ObjectId ("551FDC363AFE97CD9A55C8BC"), "X": 2} > Db.test_collection.remove ({x:2}) Writeresult ({"nremoved": 1}) > Db.test_collection.find (). Count () 0
We don't need to create a new database like MySQL and create a new table, and we can directly insert the data directly with the built-in functions. It's so cool!!
Recently looking at MongoDB