Skip to content

Commit 51a36f3

Browse files
mbroadstdaprahamian
authored andcommitted
fix: read concern only supported for mapReduce without inline
1 parent cf77a9b commit 51a36f3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/core/sessions.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -625,17 +625,24 @@ class ServerSessionPool {
625625

626626
// TODO: this should be codified in command construction
627627
// @see https://github.com./mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#read-concern
628-
function commandSupportsReadConcern(command) {
629-
return (
628+
function commandSupportsReadConcern(command, options) {
629+
if (
630630
command.aggregate ||
631631
command.count ||
632632
command.distinct ||
633633
command.find ||
634-
command.mapReduce ||
635634
command.parallelCollectionScan ||
636635
command.geoNear ||
637636
command.geoSearch
638-
);
637+
) {
638+
return true;
639+
}
640+
641+
if (command.mapReduce && options.out && (options.out.inline === 1 || options.out === 'inline')) {
642+
return true;
643+
}
644+
645+
return false;
639646
}
640647

641648
/**

0 commit comments

Comments
 (0)