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

KeyRetriever uses majority read concern in a hard-coded way that breaks while disabling majority read concern

    XMLWordPrintableJSON

Details

    Description

      I'm using client-side field-level encryption. I realized when the driver wants to fetch the key from db, it uses com.mongodb.client.internal.KeyRetriever class internally:

          public List<BsonDocument> find(final BsonDocument keyFilter) {
              return client.getDatabase(namespace.getDatabaseName()).getCollection(namespace.getCollectionName(), BsonDocument.class)
                      .withReadConcern(ReadConcern.MAJORITY)
                      .find(keyFilter).into(new ArrayList<BsonDocument>());
          }
      

      I can see readConcern has set to majority. This one leads to a problem since I use a PSA architecture and I disabled the majority read concern as it's suggested in the MongoDB documentation
      this method should respect the client setting that I've provided while creating the client:

      ClientEncryptionSettings clientEncryptionSettings = ClientEncryptionSettings.builder()
              .keyVaultMongoClientSettings(MongoClientSettings.builder()
                      .applyConnectionString(new ConnectionString(mongodbUri))
                      .readConcern(ReadConcern.AVAILABLE)
                      .build())
      

      but it doesn't
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            javadi91.5@gmail.com Mohammad Javadi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: