Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2081

MongoClient does not respect ReadPreference

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Command Operations
    • None
    • Environment:
      Linux 64 Bit

      In the API doc is stated:

      By default, all read and write operations will be made on the primary, but it's possible to read from secondaries by changing the read preference:
      mongoClient.setReadPreference(ReadPreference.secondaryPreferred());


      However, this seems not to apply at least to the follwing methods because they are overriding the actual set ReadPreference by "ReadPreference.primary()":

      • listDatabases()
      • listDatabaseNames()
      • getDatabase(dbName).listCollections()

      This is very annoying because we want explicitly get this info from a secondary.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.agahd@idealo.de Kay Agahd
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: