MongoDB database documentation

Source: Internet
Author: User

MongoDBDataLibrary Introduction
MongoDB is a highPerformance,Open Source, NoneModeDocumentationDatabaseIt can be used in many scenarios to replace the traditional relational database or key/value storage mode. MongoDB uses C ++Development, Provides the following features:

  • Set-oriented storage: Suitable for storing objects and JSON data.
  • Dynamic query: Mongo supports multiple Query expressions. Query commands use JSON tags to easily query embedded objects and arrays in a document.
  • Complete indexing support: Includes embedded object and array of documents. Mongo QueryOptimizationAnalyzer analyzes the query expression and generates an efficient query plan.
  • Query monitoring: Mongo includes a monitoringToolsUsed to analyze the performance of database operations.
  • Replication and automatic failover: supported by the Mongo DatabaseServerSupports master-slave mode andServiceMutual replication between devices. The primary objective of replication is to provide redundancy and auto failover.
  • Efficient traditional storage: supports binary data and large objects (such as photos or images ).
  • Automatic sharding to support cloud-level Scalability (in the early alpha stage): the automatic sharding function supports horizontal DatabasesClusterTo dynamically add additional machines.

MongoDB's primary goal is to provide high performance and high scalability in key/value storage and traditional RDBMSSystem(Rich functions) Build a bridge to combine the advantages of both. Mongo is applicable to the following scenarios:

  • Website data: Mongo is ideal for real-time insertion, update, and query, as well as the replication and high scalability required for real-time website data storage.
  • Cache: Because of high performance, Mongo is also suitable for informationBasicThe cache layer of the facility. After the system is restarted, the persistent cache layer established by Mongo can avoid data source overload at the lower layer.
  • Large-sized and low-value data: traditional relational databases may be expensive to store some data.ProgramMembers often choose the traditionalFileFor storage.
  • High scalability: Mongo is ideal for databases consisting of dozens or hundreds of servers. The Mongo roadmap contains built-in support for the MapReduce engine.
  • For object and JSON Data Storage: Mongo's BSON data format is very suitable for storing and querying document-based data.

Naturally, there are some restrictions on the use of MongoDB, for example, it is not suitable:

  • A highly transactional system, such as a banking or accounting system. Traditional relational databases are still more suitable for complex transactions that require a large number of atoms.ApplicationProgram.
  • Traditional Business Intelligence applications: BI databases for specific problems will produce highly optimized query methods. For such applications, data warehouse may be a more appropriate choice.
  • SQL Problems

MongoDB supports OS X, Linux, and Windows.Operating SystemAnd provides drivers for Python, PHP, Ruby, Java, C, C #, Javascript, Perl, and C ++. The community also providesPlatformDriver

Usage:

Log on to mongoDB using the mongo client program

  1. Falcon@www.fwphp.cn ~ /Mongodb] $ bin/mongo
  2. MongoDBShellVersion: 1.2.4-
  3. Url: test
  4. Connecting to: test
  5. Type "help" for help
  6. > Help
  7. HELP
  8. Show dbs Show Database Name
  9. Show collections shows the collection of the current database
  10. Show users
  11. Show profile: displays the system overview with the last system time greater than 1 ms
  12. Use <db name> switch to database
  13. Db. help () help on DB methods
  14. Db. foo. help () help on collection methods
  15. Db. foo. find () list objects in collection foo
  16. Db. foo. find ({a: 1}) list objects in foo where a = 1
  17. It result of the last line evaluated; use to further iterate
  18. > Show dbs has two databases by default.
  19. Admin
  20. Local
  21. > Switch use admin to the admin database.
  22. Switched to db admin
  23. > Show collections: displays the collection below the admin Database
  24. System. indexes

Next we will simply create a collection, insert, update, and query data to experience the different things mongodb brings to us.
The method for creating a database is in
Create a collection:

  1. > Db. createCollection ("user ");
  2. {"OK": 1}
  3. > Show collections
  4. System. indexes
  5. User
  6. >
  • 1
  • 2
  • 3
  • 4
  • Next Page

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.