Skip to content

Commit

Permalink
test(populate): make #9906 test more robust to ordering issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Feb 22, 2021
1 parent 60f522b commit 6a12b6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/model.populate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9973,7 +9973,9 @@ describe('model: populate:', function() {
{ title: 'Second post', commentsIds: [commonComment, comments[1]] }
]);

posts = yield Post.find().populate({ path: 'commentsIds', perDocumentLimit: 2, sort: { content: 1 } });
posts = yield Post.find().
sort({ title: 1 }).
populate({ path: 'commentsIds', perDocumentLimit: 2, sort: { content: 1 } });
assert.equal(posts.length, 2);
assert.ok(!Array.isArray(posts[0].commentsIds[0]));

Expand Down

0 comments on commit 6a12b6c

Please sign in to comment.