I'm using vertx and Mongodb. I wanted to bulkWrite an array of documents and that was easily achievable with:
Observable<MongoClientBulkWriteResult> insertAll = mongoClient.rxBulkWrite("collection", documentsToInsert).toObservable();
My problem now is that i can't get the ids of the documents that i just inserted. I thought this could be achived with:
insertAll.subscribe( records -> {
// this returns correctly the number of documents inserted
logger.info("There were inserted this amount of records " + records.getInsertedCount());
// this returns empty array []
logger.info("Records inserted " + records.getUpserts());
})
I dont understand why records.getUpserts() returns empty array. Shouldn't this method return the list of IDs of the documents inserted?
Documentation says:
"An unmodifiable list of upsert data. Each entry has the index of the request that lead to the upsert, and the generated ID of the upsert."
Maybe I misunderstood something.