[SERVER-6002] Query on same field with $gt/$gte and $lt/$lte ignores one end of the range Created: 05/Jun/12  Updated: 15/Aug/12  Resolved: 05/Jun/12

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Nic Cottrell (Personal) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL


Issue Links:
Duplicate
duplicates SERVER-4180 Allow multiple constraints (on same f... Closed
Operating System: ALL
Participants:

 Description   

db.Example.find({ $and: [

{ lc: "eng" }

, { wordCount:

{ $gte: 4 }

}, { wordCount:

{ $lte: 5 }

}, { $or: [

{ group: "transmachina" }

,

{ group: "all" }

] },

{pattern: false}

, { "indices.textLc":

{ $in: [ "plain text", "plain", "text" ] }

} ] }).explain();

gives

{
"cursor" : "BtreeCursor indices.textLc_1_group_1_lc_1_wordCount_1_pattern_1_clExists_1 multi",
"nscanned" : 7571,
"nscannedObjects" : 7513,
"n" : 97,
"millis" : 78429,
"nYields" : 1143,
"nChunkSkips" : 0,
"isMultiKey" : true,
"indexOnly" : false,
"indexBounds" : {
"indices.textLc" : [
[
"plain",
"plain"
],
[
"plain text",
"plain text"
],
[
"text",
"text"
]
],
"group" : [
[

{ "$minElement" : 1 }

,

{ "$maxElement" : 1 }

]
],
"lc" : [
[
"eng",
"eng"
]
],
"wordCount" : [
[
4,
1.7976931348623157e+308
]
],
"pattern" : [
[
false,
false
]
],
"clExists" : [
[

{ "$minElement" : 1 }

,

{ "$maxElement" : 1 }

]
]
}
}

Note that the limit { wordCount:

{ $lte: 5 }

} is ignored and thousands of objects are scanned needlessly



 Comments   
Comment by Aaron Staple [ 05/Jun/12 ]

Hi Nic - This is SERVER-4180.

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