[GODRIVER-735] ListCollections does not use read preference primary Created: 21/Dec/18  Updated: 28/Oct/23  Resolved: 05/Jan/19

Status: Closed
Project: Go Driver
Component/s: Command & Dispatch
Affects Version/s: 0.1.0
Fix Version/s: 0.2.0

Type: Bug Priority: Critical - P2
Reporter: David Golden Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by TOOLS-1833 Migrate tools (excluding mongoreplay)... Closed

 Description   

The ListCollections database method passes through the database's read selector instead of constructing a new read selector for read preference primary. (Compare to how ListDatabases does it.)

Because the constructed command adds read preference primary (despite possibly selecting a non-primary server), ListCollections run on a database with secondary read preference will fail with an error: "(NotMasterNoSlaveOk) not master and slaveOk=false".



 Comments   
Comment by Githook User [ 05/Jan/19 ]

Author:

{'username': 'divjotarora', 'email': 'divjot.arora@10gen.com', 'name': 'Divjot Arora'}

Message: Change ListCollections, ListIndexes, and ListDatabases to use CompositeSelector.

GODRIVER-735

Change-Id: Ic9627f5faa8249a860620642989dc2d292d97cd8
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/48f45a6ba693b8c53a22818a804b53bfb776a436

Comment by Jeffrey Yemin [ 27/Dec/18 ]

Note: it should construct a CompositeSelector, as RunCommand does, to include the LatencySelector. This is actually a bug in ListDatabases as well, since it also doesn't include the LatencySelector.

Generated at Thu Feb 08 08:34:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.