Skip to content

Commit 8adf403

Browse files
committed
1 parent 004446d commit 8adf403

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/tree.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = exports = tree;
1717
function tree(schema, options) {
1818

1919
var pathSeparator = options && options.pathSeparator || '#'
20+
, wrapChildrenTree = options && options.wrapChildrenTree
2021
, onDelete = options && options.onDelete || 'DELETE' //'REPARENT'
2122
, numWorkers = options && options.numWorkers || 5
2223
, idType = options && options.idType || Schema.ObjectId
@@ -360,7 +361,10 @@ function tree(schema, options) {
360361
options.sort = {};
361362
}
362363
options.sort.path = 1;
363-
options.lean = true;
364+
365+
if (options.lean == null) {
366+
options.lean = !wrapChildrenTree;
367+
}
364368

365369
return this.find(filters, fields, options, function (err, results) {
366370

0 commit comments

Comments
 (0)