use MongoClient.is_mongos in ensure indexes #1759

This commit is contained in:
Erdenezul Batmunkh 2018-05-20 12:31:27 +08:00
parent a2d3bcd571
commit 257a43298b

View File

@ -854,7 +854,7 @@ class Document(BaseDocument):
collection = cls._get_collection()
# 746: when connection is via mongos, the read preference is not necessarily an indication that
# this code runs on a secondary
if not collection.is_mongos and collection.read_preference > 1:
if not collection.database.client.is_mongos and collection.read_preference > 1:
return
# determine if an index which we are creating includes