Set SlaveOkay bit for list_indexes / index_information.
This commit is contained in:
parent
a489bcf5b4
commit
edd513d3a2
@ -1259,7 +1259,7 @@ class Collection(common.BaseObject):
|
||||
namespace = "%s.%s" % (self.__database.name, "system.indexes")
|
||||
res = helpers._first_batch(
|
||||
sock_info, namespace, {"ns": self.__full_name},
|
||||
0, ReadPreference.PRIMARY, CodecOptions(SON))
|
||||
0, slave_ok, CodecOptions(SON))
|
||||
cursor = {
|
||||
"id": res["cursor_id"],
|
||||
"firstBatch": res["data"],
|
||||
|
||||
@ -226,14 +226,10 @@ def _check_gle_response(response):
|
||||
|
||||
|
||||
def _first_batch(sock_info, namespace, query,
|
||||
limit, read_preference, codec_options):
|
||||
limit, slave_ok, codec_options):
|
||||
"""Simple query helper for retrieving a first (and possibly only) batch."""
|
||||
query = _Query(0, namespace, 0, limit, query, None, codec_options)
|
||||
|
||||
# XXX: Set slaveOkay flag when read preference mode is anything other
|
||||
# than primary (0). Make this more clear when we finish refactoring
|
||||
# read preferences.
|
||||
request_id, msg, max_doc_size = query.get_message(read_preference.mode)
|
||||
request_id, msg, max_doc_size = query.get_message(slave_ok)
|
||||
sock_info.send_message(msg, max_doc_size)
|
||||
response = sock_info.receive_message(1, request_id)
|
||||
return _unpack_response(response, None, codec_options)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user