Skip to content

Commit 1cd3cda

Browse files
committed
fix: prevent propagation of projection of fields filter to include
1 parent 06b7239 commit 1cd3cda

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/mongodb.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,10 +1399,7 @@ MongoDB.prototype.all = function all(modelName, filter, options, callback) {
13991399

14001400
options = buildOptions({}, options);
14011401

1402-
if (fields) {
1403-
options.projection = fieldsArrayToObj(fields);
1404-
}
1405-
this.execute(modelName, 'find', query, options, processResponse);
1402+
this.execute(modelName, 'find', query, fields ? {projection: fieldsArrayToObj(fields), ...options} : options, processResponse);
14061403

14071404
function processResponse(err, cursor) {
14081405
if (err) {

0 commit comments

Comments
 (0)