Skip to content

Commit

Permalink
fix: read concern only supported for mapReduce without inline
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst authored and daprahamian committed Aug 13, 2019
1 parent cf77a9b commit 51a36f3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/core/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,17 +625,24 @@ class ServerSessionPool {

// TODO: this should be codified in command construction
// @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#read-concern
function commandSupportsReadConcern(command) {
return (
function commandSupportsReadConcern(command, options) {
if (
command.aggregate ||
command.count ||
command.distinct ||
command.find ||
command.mapReduce ||
command.parallelCollectionScan ||
command.geoNear ||
command.geoSearch
);
) {
return true;
}

if (command.mapReduce && options.out && (options.out.inline === 1 || options.out === 'inline')) {
return true;
}

return false;
}

/**
Expand Down

0 comments on commit 51a36f3

Please sign in to comment.