public static Write write() {
    return new AutoValue_MongoDbIO_Write.Builder()
        .setMaxConnectionIdleTime(60000)
        .setBatchSize(1024L)
        .setSslEnabled(false)
        .setIgnoreSSLCertificate(false)
        .setSslInvalidHostNameAllowed(false)
        .setOrdered(true)
        .build();
  }
@Test
  public void testUpdate() {
    final String collectionName = "testUpdate";
    final int numElements = 100;
    Document doc = Document.parse("{\"id\":1,\"scientist\":\"Updated\",\"country\":\"India\"}");

    database.getCollection(collectionName).insertMany(createDocuments(numElements, true));
    assertEquals(numElements, countElements(collectionName));
    List<Document> docs = new ArrayList<>();
    docs.add(doc);
    pipeline
        .apply(Create.of(docs))
        .apply(
            MongoDbIO.write()
                .withUri("mongodb://localhost:" + port)
                .withDatabase(DATABASE_NAME)
                .withCollection(collectionName)
                .withUpdateConfiguration(
                    UpdateConfiguration.create()
                        .withUpdateKey("id")
                        .withUpdateFields(
                            UpdateField.fieldUpdate("$set", "scientist", "scientist"),
                            UpdateField.fieldUpdate("$set", "country", "country"))));
    pipeline.run();

    Document out = database.getCollection(collectionName).find(new Document("_id", 1)).first();
    assertEquals("Updated", out.get("scientist"));
    assertEquals("India", out.get("country"));
  }