Add _read_concern to copied properties. Add read_concern to aggregate. Add test to check the read_concern and read_preference values are kept after cloning.

This commit is contained in:
Agustin Barto
2020-05-20 18:56:13 -03:00
parent 4275c2d7b7
commit 1698f398eb
2 changed files with 30 additions and 2 deletions

View File

@@ -789,6 +789,7 @@ class BaseQuerySet:
"_snapshot",
"_timeout",
"_read_preference",
"_read_concern",
"_iter",
"_scalar",
"_as_pymongo",
@@ -1311,10 +1312,11 @@ class BaseQuerySet:
final_pipeline = initial_pipeline + user_pipeline
collection = self._collection
if self._read_preference is not None:
if self._read_preference is not None or self._read_concern is not None:
collection = self._collection.with_options(
read_preference=self._read_preference
read_preference=self._read_preference, read_concern=self._read_concern
)
return collection.aggregate(final_pipeline, cursor={}, **kwargs)
# JS functionality