Skip to content

Instantly share code, notes, and snippets.

@evanchooly
Created February 16, 2016 15:58
Show Gist options
  • Save evanchooly/9d3ab75d5269e994c6d3 to your computer and use it in GitHub Desktop.
Save evanchooly/9d3ab75d5269e994c6d3 to your computer and use it in GitHub Desktop.
MongoClient client = MongoClients.create(MongoClientSettings.builder()
.clusterSettings(ClusterSettings.builder().hosts(Collections.singletonList(new ServerAddress("localhost"))).build())
.writeConcern(WriteConcern.UNACKNOWLEDGED).build());
System.out.println(client.getSettings().getWriteConcern());
client.getDatabase("test").getCollection("writeConcernTest").insertOne(new Document(), (result, t) -> System.out.println("DONE!"));
Thread.sleep(Long.MAX_VALUE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment