Recently looking at MongoDB

Source: Internet
Author: User

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

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.