Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8644

2d geo query with predicate operators treated as exact point match

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.0
    • Affects Version/s: None
    • Component/s: Geo, Querying
    • None
    • ALL

      A query on a 2d indexed field using non geo predicates is treated as an exact geo point lookup:

      Test

      c = db.c;
      c.drop();
      c.ensureIndex( { loc:'2d' } );
      c.save( { loc:[ 4, 5 ] } );
      printjson( c.find( { loc:{ $gt:4, $lt:5 } } ).explain( true ) );
      

      Output

      {
      	"cursor" : "GeoBrowse-circle",
      	"isMultiKey" : false,
      	"n" : 1,
      	"nscannedObjects" : 1,
      	"nscanned" : 1,
      	"nscannedObjectsAllPlans" : 1,
      	"nscannedAllPlans" : 1,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 0,
      	"indexBounds" : {
      		"loc" : [
      			[
      				[
      					3.999999761581421,
      					4.9999916553497314
      				],
      				[
      					4.0000104904174805,
      					5.000002384185791
      				]
      			],
      			[
      				[
      					3.9999890327453613,
      					4.9999916553497314
      				],
      				[
      					3.999999761581421,
      					5.000002384185791
      				]
      			],
      			[
      				[
      					3.999994397163391,
      					5.000002384185791
      				],
      				[
      					3.999999761581421,
      					5.000007748603821
      				]
      			],
      			[
      				[
      					3.999991714954376,
      					5.000002384185791
      				],
      				[
      					3.999994397163391,
      					5.000005066394806
      				]
      			],
      			[
      				[
      					3.999991714954376,
      					5.000005066394806
      				],
      				[
      					3.999994397163391,
      					5.000007748603821
      				]
      			],
      			[
      				[
      					4.000005125999451,
      					5.000005066394806
      				],
      				[
      					4.000007808208466,
      					5.000007748603821
      				]
      			],
      			[
      				[
      					4.000005125999451,
      					5.000002384185791
      				],
      				[
      					4.000007808208466,
      					5.000005066394806
      				]
      			],
      			[
      				[
      					3.999999761581421,
      					5.000002384185791
      				],
      				[
      					4.000005125999451,
      					5.000007748603821
      				]
      			]
      		]
      	},
      	"lookedAt" : NumberLong(1),
      	"matchesPerfd" : NumberLong(0),
      	"objectsLoaded" : NumberLong(1),
      	"pointsLoaded" : NumberLong(1),
      	"pointsSavedForYield" : NumberLong(0),
      	"pointsChangedOnYield" : NumberLong(0),
      	"pointsRemovedOnYield" : NumberLong(0),
      	"allPlans" : [
      		{
      			"cursor" : "GeoBrowse-circle",
      			"n" : 1,
      			"nscannedObjects" : 1,
      			"nscanned" : 1,
      			"indexBounds" : {
      				"loc" : [
      					[
      						[
      							3.999999761581421,
      							4.9999916553497314
      						],
      						[
      							4.0000104904174805,
      							5.000002384185791
      						]
      					],
      					[
      						[
      							3.9999890327453613,
      							4.9999916553497314
      						],
      						[
      							3.999999761581421,
      							5.000002384185791
      						]
      					],
      					[
      						[
      							3.999994397163391,
      							5.000002384185791
      						],
      						[
      							3.999999761581421,
      							5.000007748603821
      						]
      					],
      					[
      						[
      							3.999991714954376,
      							5.000002384185791
      						],
      						[
      							3.999994397163391,
      							5.000005066394806
      						]
      					],
      					[
      						[
      							3.999991714954376,
      							5.000005066394806
      						],
      						[
      							3.999994397163391,
      							5.000007748603821
      						]
      					],
      					[
      						[
      							4.000005125999451,
      							5.000005066394806
      						],
      						[
      							4.000007808208466,
      							5.000007748603821
      						]
      					],
      					[
      						[
      							4.000005125999451,
      							5.000002384185791
      						],
      						[
      							4.000007808208466,
      							5.000005066394806
      						]
      					],
      					[
      						[
      							3.999999761581421,
      							5.000002384185791
      						],
      						[
      							4.000005125999451,
      							5.000007748603821
      						]
      					]
      				]
      			}
      		}
      	],
      	"server" : "Aarons-MacBook-Pro.local:27017"
      }
      

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: