Mongodb->nosql (NoSQL = not-only sql), meaning "not just SQL"

Source: Internet
Author: User


relational databases Follow acid rules


Transactions are transaction in English, similar to real-world transactions, and have the following four features:






1, A (atomicity) atomicity



Atomicity is easy to understand, that is, all operations in a transaction are either done or not, and the transaction succeeds because all operations in the transaction are successful, and as long as one operation fails, the entire transaction fails and needs to be rolled back.






For example, bank transfer, transfer from a account 100 to B account, divided into two steps: 1) from a account 100 yuan, 2) deposited into the account of 100 to B. The two steps are either completed together, or not completed together, if only the first step, the second step fails, the money will be inexplicably less than 100 yuan.






2, C (consistency) consistency



Consistency is also relatively easy to understand, that is, the database should always be in a consistent state, the operation of the transaction will not change the original consistency of the database constraints.






For example, if an existing integrity constraint a+b=10, if a transaction changes A, then the B must be changed so that the transaction will still satisfy a+b=10, otherwise the transaction fails.



3, I (isolation) Isolation



The so-called independence refers to the concurrent transactions do not affect each other, if one transaction to access the data is being modified by another transaction, as long as another transaction is not committed, the data it accesses is not affected by uncommitted transactions.



For example, there is a transaction from a to 100 yuan to the B account, in the case of the transaction is not completed, if at this time B query their own account, is not see the new increase of 100 yuan.



4, D (durability) Persistence



Persistence means that once a transaction commits, its modifications are persisted to the database, even if the outage occurs.





What is NoSQL?


NoSQL, refers to a non-relational database. NoSQL, sometimes referred to as the abbreviation of not-only SQL, is a generic term for a database management system that differs from a traditional relational database.



NoSQL is used for storage of hyper-scale data. (for example, Google or Facebook collects trillions of bits of data for their users every day). These types of data stores do not require a fixed pattern and can be scaled horizontally without extra action.


What is MongoDB?


MongoDB is written by the C + + language and is an open source database system based on distributed file storage.



In the case of high load, adding more nodes can guarantee the performance of the server.



MongoDB is designed to provide scalable, high-performance data storage solutions for Web applications.



MongoDB stores data as a document and data structures consist of key-value (key=>value) pairs. A MongoDB document is similar to a JSON object. Field values can contain other documents, arrays, and array of documents.





Key Features


  • MongoDB provides a document-oriented storage that is simple and easy to operate.
  • You can set the index of any property in the MongoDB record (for example: Firstname= "Sameer", address= "8 Gandhi Road") for faster sorting.
  • You can create data mirroring either locally or on the network, which makes MongoDB more extensible.
  • If the load increases (requiring more storage space and greater processing power), it can be distributed across other nodes in the computer network which is called a shard.
  • The MONGO supports rich query expressions. Query directives use a JSON-style tag to easily query objects and arrays embedded in the document.
  • MongoDb uses the update () command to implement a replacement of the completed document (data) or some specified data fields.
  • The map/reduce in MongoDB is primarily used for batch processing and aggregation of data.
  • Map and reduce. The map function calls emit (Key,value) to traverse all records in the collection, passing key and value to the reduce function for processing.
  • The map function and the reduce function are written in JavaScript and can be executed with the Db.runcommand or MapReduce command.
  • Gridfs is a built-in feature in MongoDB that can be used to store a large number of small files.
  • MongoDB allows you to execute scripts on the server, write a function in JavaScript, execute directly on the server, or store the definition of the function on the server, next time you call it directly.
  • MongoDB supports a variety of programming languages: ruby,python,java,c++,php,c# and many more languages.
  • MongoDB installation is simple.






Mongodb->nosql (NoSQL = not-only sql), meaning "not just SQL"


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.