summaryrefslogtreecommitdiff
path: root/jstests/core/cursor7.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/cursor7.js')
-rw-r--r--jstests/core/cursor7.js60
1 files changed, 23 insertions, 37 deletions
diff --git a/jstests/core/cursor7.js b/jstests/core/cursor7.js
index 6e77a144ba3..7807dbe22f5 100644
--- a/jstests/core/cursor7.js
+++ b/jstests/core/cursor7.js
@@ -15,14 +15,8 @@ function testMultipleInequalities(db) {
z = [{a: 1, b: 2}, {a: 3, b: 4}, {a: 5, b: 6}, {a: 7, b: 8}];
for (i = 0; i < z.length; ++i)
r.save(z[i]);
- idx = {
- a: 1,
- b: 1
- };
- rIdx = {
- a: -1,
- b: -1
- };
+ idx = {a: 1, b: 1};
+ rIdx = {a: -1, b: -1};
r.ensureIndex(idx);
checkResults([z[2], z[3]], r.find({a: {$gt: 3}}).sort(idx).hint(idx));
@@ -33,35 +27,27 @@ function testMultipleInequalities(db) {
checkResults([z[2]], r.find({a: {$gt: 3, $lt: 7}}).sort(rIdx).hint(idx));
checkResults([z[2]], r.find({a: {$gt: 3, $lt: 7, $lte: 5}}).sort(rIdx).hint(idx));
- checkResults([z[1], z[2]],
- r.find({
- a: {$gt: 1, $lt: 7, $gte: 3, $lte: 5},
- b: {$gt: 2, $lt: 8, $gte: 4, $lte: 6}
- })
- .sort(idx)
- .hint(idx));
- checkResults([z[2], z[1]],
- r.find({
- a: {$gt: 1, $lt: 7, $gte: 3, $lte: 5},
- b: {$gt: 2, $lt: 8, $gte: 4, $lte: 6}
- })
- .sort(rIdx)
- .hint(idx));
-
- checkResults([z[1], z[2]],
- r.find({
- a: {$gte: 1, $lte: 7, $gt: 2, $lt: 6},
- b: {$gte: 2, $lte: 8, $gt: 3, $lt: 7}
- })
- .sort(idx)
- .hint(idx));
- checkResults([z[2], z[1]],
- r.find({
- a: {$gte: 1, $lte: 7, $gt: 2, $lt: 6},
- b: {$gte: 2, $lte: 8, $gt: 3, $lt: 7}
- })
- .sort(rIdx)
- .hint(idx));
+ checkResults(
+ [z[1], z[2]],
+ r.find({a: {$gt: 1, $lt: 7, $gte: 3, $lte: 5}, b: {$gt: 2, $lt: 8, $gte: 4, $lte: 6}})
+ .sort(idx)
+ .hint(idx));
+ checkResults(
+ [z[2], z[1]],
+ r.find({a: {$gt: 1, $lt: 7, $gte: 3, $lte: 5}, b: {$gt: 2, $lt: 8, $gte: 4, $lte: 6}})
+ .sort(rIdx)
+ .hint(idx));
+
+ checkResults(
+ [z[1], z[2]],
+ r.find({a: {$gte: 1, $lte: 7, $gt: 2, $lt: 6}, b: {$gte: 2, $lte: 8, $gt: 3, $lt: 7}})
+ .sort(idx)
+ .hint(idx));
+ checkResults(
+ [z[2], z[1]],
+ r.find({a: {$gte: 1, $lte: 7, $gt: 2, $lt: 6}, b: {$gte: 2, $lte: 8, $gt: 3, $lt: 7}})
+ .sort(rIdx)
+ .hint(idx));
}
testMultipleInequalities(db);