I have the following query.explain (1) -Output. This is a detailed conclusion, and my question is how to read it. How is the order of operations? Does it start with GEO_NEAR_2DSPHERE or with LIMIT? What promotes the field?
And most importantly, where is this documented? Could not find this in mongoDB manual :(
Query:
db.nodesWays.find( { geo:{ $nearSphere:{ $geometry:{ type: "Point", coordinates: [lon, lat] } } }, "amenity":"restaurant" }, {name:1} ).limit(10).explain(1)
Exit:
{ "cursor" : "S2NearCursor", "isMultiKey" : false, "n" : 10, "nscannedObjects" : 69582, "nscanned" : 69582, "nscannedObjectsAllPlans" : 69582, "nscannedAllPlans" : 69582, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 543, "nChunkSkips" : 0, "millis" : 606, "indexBounds" : { }, "allPlans" : [ { "cursor" : "S2NearCursor", "isMultiKey" : false, "n" : 10, "nscannedObjects" : 69582, "nscanned" : 69582, "scanAndOrder" : false, "indexOnly" : false, "nChunkSkips" : 0, "indexBounds" : { } } ], "server" : "DBTest:27017", "filterSet" : false, "stats" : { "type" : "LIMIT", "works" : 69582, "yields" : 543, "unyields" : 543, "invalidates" : 0, "advanced" : 10, "needTime" : 69572, "needFetch" : 0, "isEOF" : 1, "children" : [ { "type" : "PROJECTION", "works" : 69582, "yields" : 543, "unyields" : 543, "invalidates" : 0, "advanced" : 10, "needTime" : 0, "needFetch" : 0, "isEOF" : 0, "children" : [ { "type" : "FETCH", "works" : 69582, "yields" : 543, "unyields" : 543, "invalidates" : 0, "advanced" : 10, "needTime" : 69572, "needFetch" : 0, "isEOF" : 0, "alreadyHasObj" : 4028, "forcedFetches" : 0, "matchTested" : 10, "children" : [ { "type" : "GEO_NEAR_2DSPHERE", "works" : 69582, "yields" : 0, "unyields" : 0, "invalidates" : 0, "advanced" : 4028, "needTime" : 0, "needFetch" : 0, "isEOF" : 0, "children" : [ ] } ] } ] } ] } }