[SERVER-17064] indexBounds error Created: 27/Jan/15  Updated: 14/Apr/16  Resolved: 27/Jan/15

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.6.7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: wencan Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File test_sp.location_951945225586631.json    
Issue Links:
Related
is related to SERVER-15086 Allow for efficient range queries ove... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

> part.findOne()
{
	"_id" : ObjectId("54bf9b01bef23df039fb0caf"),
	"mac" : "0026C76A6E08",
	"location" : {
		"timestamp" : ISODate("2015-01-21T12:27:31Z"),
		"pos_status" : 0,
		"x" : 49.37150573730469,
		"y" : 5.593080043792725,
		"ip" : ""
	},
	"customer" : [ ],
	"ofi" : [
		{
			"oft" : 0,
			"id" : "0"
		},
		{
			"oft" : 0,
			"id" : "1"
		},
		{
			"oft" : 0,
			"id" : "A"
		}
	]
}
 
> part.ensureIndex({'location.timestamp': 1, 'ofi.id': 1})
{
	"createdCollectionAutomatically" : false,
	"numIndexesBefore" : 2,
	"numIndexesAfter" : 3,
	"ok" : 1
}
 
> part.find({'location.timestamp': {'$gte': new Date('2015-01-21 12:00:00'), '$lt': new Date('2015-01-21 22:00:00')}}).hint({'location.timestamp':1, 'ofi.id': 1}).explain()
{
	"cursor" : "BtreeCursor location.timestamp_1_ofi.id_1",
	"isMultiKey" : true,
	"n" : 500,
	"nscannedObjects" : 500,
	"nscanned" : 1500,
	"nscannedObjectsAllPlans" : 500,
	"nscannedAllPlans" : 1500,
	"scanAndOrder" : false,
	"indexOnly" : false,
	"nYields" : 11,
	"nChunkSkips" : 0,
	"millis" : 2,
	"indexBounds" : {
		"location.timestamp" : [
			[
				true,
				ISODate("2015-01-21T14:00:00Z")
			]
		],
		"ofi.id" : [
			[
				{
					"$minElement" : 1
				},
				{
					"$maxElement" : 1
				}
			]
		]
	},
	"server" : "smartac-2015:27017",
	"filterSet" : false
}



 Comments   
Comment by David Storch [ 27/Jan/15 ]

Hi wencan,

Thanks for the bug report! This is expected behavior, so I am closing as Works as Designed. Please refer to the documentation on multikey index bouds for more information.

You may also be interested in SERVER-15086, a related feature request which could allow the server to tighten the index bounds in cases such as this one. Please watch that ticket for progress updates.

Feel free to reach out with any further questions.

Best,
Dave

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