Calvin Lam
03/10/2022, 8:13 AMAugustin Lafanechere (Airbyte)
03/10/2022, 2:05 PMread
method is correct: I'm afraid that my answer is "no, our MongoDB connector does not support multi-document transactions".
Here's the read
implementation :
public Stream<JsonNode> read(final String collectionName, final List<String> columnNames, final Optional<Bson> filter) {
try {
final MongoCollection<Document> collection = database.getCollection(collectionName);
final MongoCursor<Document> cursor = collection
.find(filter.orElse(new BsonDocument()))
.batchSize(BATCH_SIZE)
.cursor();
return getStream(cursor, (document) -> MongoUtils.toJsonNode(document, columnNames))
.onClose(() -> {
try {
cursor.close();
} catch (final Exception e) {
throw new RuntimeException();
}
});
} catch (final Exception e) {
LOGGER.error("Exception attempting to read data from collection: ", collectionName, e.getMessage());
throw new RuntimeException(e);
}
Calvin Lam
03/11/2022, 9:41 AMMarcos Marx (Airbyte)
03/11/2022, 7:46 PM