Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
3.8.0
-
None
Description
The following code throws a NullPointerException at com.mongodb.internal.connection.ProtocolHelper.getErrorCode(ProtocolHelper.java:183). It appears retryWrites needs to be disabled in order to use WriteConcern.UNACKNOWLEDGED for insert/update operations.
MongoClient mongoClient = MongoClients.create("mongodb://username:password@localhost:27017/?retryWrites=true"); |
MongoDatabase db = mongoClient.getDatabase("foo"); |
db.getCollection("bar").withWriteConcern(WriteConcern.UNACKNOWLEDGED).insertOne(new Document("_id", new ObjectId())); |