lib/mongoid/contextual/map_reduce.rb in mongoid-7.0.0.beta vs lib/mongoid/contextual/map_reduce.rb in mongoid-7.0.0

- old
+ new

@@ -164,16 +164,16 @@ # @since 3.0.0 def raw validate_out! cmd = command opts = { read: cmd.delete(:read).options } if cmd[:read] - @map_reduce.database.command(cmd, opts || {}).first + @map_reduce.database.command(cmd, (opts || {}).merge(session: session)).first end alias :results :raw # Execute the map/reduce, returning the raw output. - # Useful when you don't care about map/reduce's ouptut. + # Useful when you don't care about map/reduce's output. # # @example Run the map reduce # map_reduce.execute # # @return [ Hash ] The raw output @@ -246,9 +246,13 @@ private def validate_out! raise Errors::NoMapReduceOutput.new({}) unless @map_reduce.out + end + + def session + criteria.send(:session) end end end end