-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 2.16.0
-
Component/s: None
-
None
Original report:
when you do:
collection.find({}, session: x).count_documents
it doesn't use the session that is stored in the options of the View that find returns
Sorry if I didn't specify clearly enough. In an attempt to clarify more, I monkeypatched the method like so:
opts = opts.select{ |k, _| [:hint, :max_time_ms, :read, :collation, :session].include?(k) }
opts[:collation] ||= collation
opts[:session] ||= options[:session]
This then allows you to override the session when calling count_documents but by default it will use the one already specified on the View
----------------------
There is precedent for some find options not being applicable to subsequent methods, for example limit given to find does not apply to updates (which could update either a single document or all matching documents, but not an arbitrary number of them).
As part of this ticket at least all of the view methods should be reviewed for behaving consistently with respect to either using or not using the session option given to find.
Additionally, reference documentation needs to be reviewed and likely updated to state that find session will carry over to other operations.