MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / read_preference

Method read_preference

mongoengine/queryset/base.py:1242–1252  ·  view source on GitHub ↗

Change the read_preference when querying. :param read_preference: override ReplicaSetConnection-level preference.

(self, read_preference)

Source from the content-addressed store, hash-verified

1240 return queryset
1241
1242 def read_preference(self, read_preference):
1243 """Change the read_preference when querying.
1244
1245 :param read_preference: override ReplicaSetConnection-level
1246 preference.
1247 """
1248 validate_read_preference("read_preference", read_preference)
1249 queryset = self.clone()
1250 queryset._read_preference = read_preference
1251 queryset._cursor_obj = None # we need to re-create the cursor object whenever we apply read_preference
1252 return queryset
1253
1254 def read_concern(self, read_concern):
1255 """Change the read_concern when querying.

Callers 4

reloadMethod · 0.80
test_read_preferenceMethod · 0.80

Calls 1

cloneMethod · 0.95