Files
mongo/jstests/core/sort3.js
Kyle Suarez 969ddd3d92 SERVER-30384 tests should specify a sort when expecting an ordering for a query
This refactors several tests in core to not rely on an implicit sort
order, which allows them to be unblacklisted from the causally
consistent jscore passthroughs.
2017-11-22 11:32:23 -05:00

14 lines
369 B
JavaScript

(function() {
"use strict";
const coll = db.sort3;
coll.drop();
assert.writeOK(coll.insert({a: 1}));
assert.writeOK(coll.insert({a: 5}));
assert.writeOK(coll.insert({a: 3}));
assert.eq([1, 3, 5], coll.find().sort({a: 1}).toArray().map(doc => doc.a));
assert.eq([5, 3, 1], coll.find().sort({a: -1}).toArray().map(doc => doc.a));
}());