Getting Exception when trying to execute listDabses command on secondery member

8 views
Skip to first unread message

majeed said

unread,
Jan 11, 2018, 4:19:26 AM1/11/18
to mongodb-dev
Hi,

 i trying to connect to a secondery member in a replicaSet using the driver version 3.6.1:
 im getting the exception "java MongoNotPrimaryException: The server is not the primary and did not execute the operation"

 with older versions of driver 3.4.2 there was no problem:
code in java :

ListDatabasesIterable<Document> listDatabases = mongoClient.listDatabases();

for (Document dbDoc : listDatabases) {
  //....do something

}


  is there any way to solve this issue? maybe any configuration in the replicaset?

 Best Regards,
 Majeed
Reply all
Reply to author
Forward
0 new messages