About MongoDB

Source: Internet
Author: User

Tags: format tag character add Web App with same + + case

First, what is MongoDB

MongoDB is written by C + + 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 provides scalable, high-performance data storage solutions for Web applications

Ii. Features of MongoDB

1, MongoDB provides a document-oriented storage, the basic idea is to replace the original "line" concept into a more "document" model, a record can represent a very complex hierarchical relationship
2, MongoDB support rich query expressions, query directives are JSON-style markup, you can easily query the document nested objects and lists
3, very easy to expand, after the expansion of the cluster can also realize the load balance of the data in the cluster.
4. MongoDB supports a variety of programming languages, such as Python, Java, C + +, C, PHP, C #, Ruby, JavaScript, etc.
5, rich features, including index, storage JavaScript, aggregation, fixed set, file storage and other functions
6, convenient management, processing start-up database services, demerit no other necessary operations. To manage a cluster, you only need to know which new node you have, and automatically inherit and configure it.

Third, MongoDB concept

The basic concept in MongoDB is a document, a collection, a database

  Database:

* One MongoDB can build multiple databases

* MongoDB default database is ' DB ', the database in the data directory

* A single instance of MongoDB can hold multiple independent databases, each with its own collection and permissions, and different databases placed in different files

Database naming rules:

The database name can be any UTF-8 string that can meet the following criteria

-cannot be an empty string ("")

-Must not contain ' (spaces), $,/, \, and.

-Should all lowercase

-Up to 64 bytes

Some database names are reserved and can be accessed directly from these databases with special effects.

Admin: From a permission point of view, this is the ' root ' database. If you add a user to this database, the user automatically inherits the permissions of all the databases. Some specific server commands can only be run from this database, such as listing all databases or shutting down the database.

Local: This data is never copied and can be used to store any collection that is limited to a local single server

Config: When MongoDB is used for sharding settings, the Config database is used internally to store information about shards.

  Document:

The document is equivalent to the MySQL data row. A document is a set of key-value pairs (BSON). MongoDB documents do not need to set the same field, and the same field does not require the same data type

For example:{"name":"Moonlight male God", "Age ": "+"}

Attention:

1. The key-value pairs in the document are ordered

2. The value in the document can be not only a string in double quotes, but also a different data type

3. MongoDB differentiated types and capitalization

4. MongoDB documents cannot have duplicate keys

5, the key of the document is a string, with the exception of a few exceptions, the key can use any UTF-8 character

Document key naming specification:

1, the key cannot contain the (null character). This character is used to denote the end of a key

2,. and $ have a special meaning and can only be used in certain circumstances

3. Keys that start with "_" are reserved

  Collection

Collections are equivalent to tables in MySQL, collections exist in the database, collections do not have a fixed structure, and data can be inserted into different types and formats.

Collection Naming conventions:

The collection name cannot be an empty string.

The collection name cannot contain the \ s character (null character), which represents the end of the collection name.

The collection name cannot start with "system", which is a reserved prefix for the system collection

The name of a user-created collection cannot contain reserved characters. Never appear $.

About 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.

Tags Index: