Skip to content

Commit

Permalink
fix(populate): handle populating subdoc array virtual with sort
Browse files Browse the repository at this point in the history
Fix #10552
  • Loading branch information
vkarpov15 committed Aug 17, 2021
1 parent 283d43f commit 6b92599
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/helpers/populate/assignRawDocsToIdStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
if (recursed) {
if (doc) {
if (sorting) {
newOrder[resultOrder[sid]] = doc;
const _resultOrder = resultOrder[sid];
if (Array.isArray(_resultOrder) && Array.isArray(doc) && _resultOrder.length === doc.length) {
newOrder.push(doc);
} else {
newOrder[_resultOrder] = doc;
}
} else {
newOrder.push(doc);
}
Expand Down

0 comments on commit 6b92599

Please sign in to comment.