First, the index introductionIn MongoDB, indexes are used to support efficient queries. If there is no index, MONGODB must scan each document in the entire collection to find a matching document. However, if an appropriate index is established,
Indexes can often greatly improve the efficiency of queries, and if there is no index, MongoDB must scan every file in the collection and select those records that meet the query criteria when reading the data. This scan full set of query efficiency
MongoDB data model and index learning summary, mongodb ModelMongoDB data model and index learning Summary 1. MongoDB Data Model:
MongoDB data storage structure:MongoDB uses BSON (binary json, binary encoding) data format for document (large files
Previous wordsIndexes can often greatly improve the efficiency of queries, and if there is no index, MongoDB must scan every file in the collection and select those records that meet the query criteria when reading the data. This scan full set of
MongoDB Study Notes (INDEX) Postedon I. indexing basics: MongoDB indexes are almost the same as traditional relational databases, which also include some basic optimization techniques. The following command creates an index: db. test. ensureIndex
Index typeMONGDB indexes are divided into the following types: Single-key index, composite index, geospatial Index, full-text index, and hash indexSingle-key index (single Field Indexes)An index created on a key is a single-key index, which is the
MongoDB Data Model and Index learning Summary 1. MongoDB Data Model:
MongoDB Data storage structure:MongoDB uses Bson (binary JSON, binary encoded) data format to store and exchange data for documents (large files using the GRIDFS protocol).
Indexes in MongoDB are similar to other database indexes and are also used with the b-tree structure. The index of MongoDB is at the collection level and supports the creation of indexes in the sub-columns of any column or document within the
I. indexing basics:MongoDB indexes are almost identical to those of traditional relational databases, which also includes some basic optimization techniques. The following command creates an index:> Db. test. ensureIndex ({"username": 1 })You can
One, index type
(a), one -touch index
The index created on one key is the one-touch index, and the single key index is the most common index, such as the _id index created by default by MongoDB. (ii), composite index
Indexes built on multiple keys
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.