Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A list of indices in MongoDB?

Is there a way to see a list of indices on a collection in mongodb in shell? i read through http://www.mongodb.org/display/DOCS/Indexes but i dont see anything

like image 294
Timmy Avatar asked May 07 '10 15:05

Timmy


People also ask

How do I see all indexes in MongoDB?

Finding indexes You can find all the available indexes in a MongoDB collection by using the getIndexes method. This will return all the indexes in a specific collection. Result: The output contains the default _id index and the user-created index student name index.

How many types of indexes are there in MongoDB?

MongoDB provides two geospatial indexes known as 2d indexes and 2d sphere indexes using these indexes we can query geospatial data. Here, the 2d indexes support queries that are used to find data that is stored in a two-dimensional plane. It only supports data that is stored in legacy coordinate pairs.

Can MongoDB have multiple indexes?

MongoDB can use the intersection of multiple indexes to fulfill queries. In general, each index intersection involves two indexes; however, MongoDB can employ multiple/nested index intersections to resolve a query.


1 Answers

From the shell:

db.test.getIndexes() 

For shell help you should try:

help; db.help(); db.test.help(); 
like image 126
mdirolf Avatar answered Oct 03 '22 13:10

mdirolf