Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
4.4.1
-
Minor Change
-
Query Execution 2021-04-19, Query Execution 2021-05-03
Description
$skip and $limit stages do not raise any validation errors when numbers larger than MAX_LONG are passed as their arguments. Instead, they truncate arguments to MAX_LONG which could be confusing.
A few examples:
> db.test.explain().aggregate([{$sort: {x: -1}}, {$skip: 18446744073709552000}, {$limit: 6}])
|
{
|
"stages" : [
|
{
|
"$cursor" : {
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.test",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
|
|
},
|
"queryHash" : "CF095775",
|
"planCacheKey" : "CF095775",
|
"winningPlan" : {
|
"stage" : "SORT",
|
"sortPattern" : {
|
"x" : -1
|
},
|
"memLimit" : 104857600,
|
"type" : "simple",
|
"inputStage" : {
|
"stage" : "COLLSCAN",
|
"direction" : "forward"
|
}
|
},
|
"rejectedPlans" : [ ]
|
}
|
}
|
},
|
{
|
"$skip" : NumberLong("9223372036854775807")
|
},
|
{
|
"$limit" : NumberLong(6)
|
}
|
],
|
"serverInfo" : {
|
"host" : "laplab-work-mac.local",
|
"port" : 27017,
|
"version" : "4.4.1",
|
"gitVersion" : "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1"
|
},
|
"ok" : 1
|
}
|
> db.test.explain().aggregate([{$sort: {x: -1}}, {$skip: 6}, {$limit: 18446744073709552000}])
|
{
|
"stages" : [
|
{
|
"$cursor" : {
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "test.test",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
|
|
},
|
"queryHash" : "CF095775",
|
"planCacheKey" : "CF095775",
|
"winningPlan" : {
|
"stage" : "SORT",
|
"sortPattern" : {
|
"x" : -1
|
},
|
"memLimit" : 104857600,
|
"type" : "simple",
|
"inputStage" : {
|
"stage" : "COLLSCAN",
|
"direction" : "forward"
|
}
|
},
|
"rejectedPlans" : [ ]
|
}
|
}
|
},
|
{
|
"$skip" : NumberLong(6)
|
},
|
{
|
"$limit" : NumberLong("9223372036854775807")
|
}
|
],
|
"serverInfo" : {
|
"host" : "laplab-work-mac.local",
|
"port" : 27017,
|
"version" : "4.4.1",
|
"gitVersion" : "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1"
|
},
|
"ok" : 1
|
}
|
Attachments
Issue Links
- is documented by
-
DOCS-14394 Investigate changes in SERVER-51072: $skip and $limit stages silently round large doubles to MAX_LONG
-
- Closed
-