1
db.tablebusiness.find({ "LongitudeLatitude" : { "$nearSphere" : [106.772835, -6.186753], "$maxDistance" : 0.053980478460939611 }, "Prominent" : { "$gte" : 15 }, "indexContents" : { "$all" : [/^soto/, /^nasi/] } }).limit(200).explain();




{
        "cursor" : "GeoSearchCursor",
        "nscanned" : 48,
        **"nscannedObjects" : 48,**
        "n" : 48,
        "millis" : 8563,
        "nYields" : 0,
        "nChunkSkips" : 0,
        "isMultiKey" : false,
        "indexOnly" : false,
        "indexBounds" : {
        }
}
>

So what's the name of the index? I saw some questions where name of index do show up. Take a look here MongoDB: why doesn't sorting by multiple keys use an index? for example

I've also heard of explain(true) somewhere that's simply not documented here:

http://www.mongodb.org/display/DOCS/Explain

2
  • Note that mongodb.org/display/DOCS/Geospatial+Indexing indicates that you may only have 1 geospatial index per collection. That means that "GeoSearchCursor" must be using that one index. Commented Sep 11, 2012 at 13:39
  • Wait a minute. What about if we sometimes want to search dots sorted by prominent and latter want to search dots based on title. We need 2 geospatial index each of which belong to two different combination. Commented Sep 14, 2012 at 5:08

2 Answers 2

2

I'm unsure if it's intentional or a defect but when a geospatial index is used the name of the index used is not shown in the explain plan.

Only when using a BtreeCursor is the index name show.

As noted in the comment above, there can be only one geospatial index on a collection. Under this parameter you can assume that that if the cursor is the "GeoSearchCursor" it is using the index you want for this collection.

Sign up to request clarification or add additional context in comments.

Comments

2

This is a known issue. Please see https://jira.mongodb.org/browse/SERVER-4213

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.