[SERVER-8644] 2d geo query with predicate operators treated as exact point match Created: 21/Feb/13  Updated: 11/Jul/16  Resolved: 26/Aug/14

Status: Closed
Project: Core Server
Component/s: Geo, Querying
Affects Version/s: None
Fix Version/s: 2.6.0

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

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"
}


Generated at Thu Feb 08 03:17:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.