private BsonDocument fetch() {
    List<String> names = Flowable.fromPublisher(database.listCollectionNames()).toList().blockingGet();
    if (names.size() != 1) {
      throw new IllegalStateException(String.format("Expected single(1) collection but got %d: %s", names.size(), names));
    }

    List<BsonDocument> docs = Flowable.fromPublisher(database.getCollection(names.get(0))
            .withDocumentClass(BsonDocument.class).find()).toList().blockingGet();

    if (docs.size() != 1) {
      throw new IllegalStateException(String.format("Expected single(1) document but got %d: %s", docs.size(), docs));
    }

    return docs.get(0);
  }
Check correct serialization of {@code java.time.*} types like {@link LocalDate}
criteria/mongo/test/org/immutables/criteria/mongo/JavaTimeTypeTest.java