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

Community
  • 1
  • 1
user4951
  • 32,206
  • 53
  • 172
  • 282
  • Note that http://www.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. – Asya Kamsky Sep 11 '12 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. – user4951 Sep 14 '12 at 05:08

2 Answers2

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.

Macdiesel
  • 935
  • 1
  • 9
  • 19
2

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

geakie
  • 1,458
  • 9
  • 9