From 1e0cc7a347797f10297496b396eeac807e02f385 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Sun, 22 Sep 2019 10:44:32 -0700 Subject: [PATCH] test(query): repro #8159 --- test/query.toconstructor.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/query.toconstructor.test.js b/test/query.toconstructor.test.js index dc291a4036a..164456ef785 100644 --- a/test/query.toconstructor.test.js +++ b/test/query.toconstructor.test.js @@ -214,5 +214,14 @@ describe('Query:', function() { assert.strictEqual(called, 1); }); }); + + it('works with entries-style sort() syntax (gh-8159)', function() { + const Model = mongoose.model('Test', Schema({ name: String })); + + const query = Model.find().sort([['name', 1]]); + const Query = query.toConstructor(); + const q = new Query(); + assert.deepEqual(q.options.sort, [['name', 1]]); + }); }); });