diff options
Diffstat (limited to 'jstests/core/index/geo/geo_sort1.js')
-rw-r--r-- | jstests/core/index/geo/geo_sort1.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/core/index/geo/geo_sort1.js b/jstests/core/index/geo/geo_sort1.js new file mode 100644 index 00000000000..4d32c2f4ae2 --- /dev/null +++ b/jstests/core/index/geo/geo_sort1.js @@ -0,0 +1,23 @@ +t = db.geo_sort1; +t.drop(); + +for (x = 0; x < 10; x++) { + for (y = 0; y < 10; y++) { + t.insert({loc: [x, y], foo: x * x * y}); + } +} + +t.createIndex({loc: "2d", foo: 1}); + +q = t.find({loc: {$near: [5, 5]}, foo: {$gt: 20}}); +m = function(z) { + return z.foo; +}; + +a = q.clone().map(m); +b = q.clone().sort({foo: 1}).map(m); + +assert.neq(a, b, "A"); +a.sort(); +b.sort(); +assert.eq(a, b, "B"); |