Indexing in the MongoDB database

Indexing in the MongoDB database


Posted in : MogoDB Posted on : July 5, 2014 at 1:13 PM Comments : [ 0 ]

In this tutorial we will learn about the indexing feature of the MongoDB database. You will learn about the different parameters of the MongoDB index.

MongoDB Indexing - Learn about the different parameters of the MongoDB index

Indexing make the resolution process of queries more efficient and faster. More over in MongoDB indexing facilitates configuring it by the users. Indexes are data structures that utilizing a small volume of data make it easier to traverse the whole range of data and respond to the queries.

Proper index provides the high performance while querying the data set for finding certain results from the database. So, it is necessary to create the proper index into the database.

You can configure and create indexes in MongoDB indexing but doing that requires applying a method called ensure Index. The method accepts the following options.

Parameter

Type

Description

Background

Boolean

Builds the index in the background so that building an index does not You won't be requiring to block other database activities thanks to this option that facilitates building index in the background. False is the default value and so you have to specify true for building index in the background.

Unique

Boolean

This option helps to create a unique index so that any index key does not match in the collection of documents. Again the value by default is false and you have to change it to true to create a unique index.

Name

String

This option is for choosing an index name. In case you have not unspecified it, MongoDB automatically generates an index name from the other index names and sorting order.

DropDups

Boolean

This option is for creating a unique index on a field with duplicates. Again specifying true you can create unique index, because by default the value is false.

Sparse

Boolean

This option is for only indexing the reference documents with specified fields.

expireAfterSeconds

integer

This option is for specifying the time (in seconds) to control the retention time of a document in MongoDB.

v

index version

This option is for numbering the index version.

weights

document

This option is for denoting the significance of a field in relation to other indexed fields.

default_language

string

This option for determining the default indexing language. The default language is English.

language_override

string

This option is for overriding the default language.

Next tutorial: MongoDB Sharding

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics