@Override
    public MongoCollection<?> resolve(Class<?> entityClass) {
      final String name = ContainerNaming.DEFAULT.name(entityClass);
      // already exists ?
      if (!Flowable.fromPublisher(database.listCollectionNames()).toList().blockingGet().contains(name)) {
        Flowable.fromPublisher(database.createCollection(name)).blockingSubscribe();
      }

      return database.getCollection(name).withDocumentClass(entityClass).withCodecRegistry(registry);
    }
Creates mongo collection on demand. Usually in conjunction with {@link MongoExtension}.
criteria/mongo/test/org/immutables/criteria/mongo/BackendResource.java