Set SlaveOkay bit for list_indexes / index_information.

This commit is contained in:
A. Jesse Jiryu Davis 2015-03-21 17:28:49 -04:00
parent a489bcf5b4
commit edd513d3a2
2 changed files with 3 additions and 7 deletions

View File

@ -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"],

View File

@ -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)