Reputation: 4236
How well is documentDB compared to dynamo DB, considering transactions capability ?
Following is an example of transaction operation done using dynamoDB.
const transactionResponse = await docClient.transactWrite({
TransactItems: [
{
Put: {
TableName: Table1,
Item: {
id,
userId,
anotherID,
createdAt: (new Date()).toISOString()
}
}
},
{
Update: {
TableName: Table2,
Key: {anotherID},
UpdateExpression: `set available = available - :val, count = count + :val, lastUpdatedDate = :updatedAt`,
ExpressionAttributeValues: {
":val": 1,
":updatedAt": (new Date()).toISOString(),
}
}
}
]
}).promise();
Is it possible to do the same logic with DocumentDB ? I have found that, it is not possible to do multi statement transaction in AWS documentDB.
Upvotes: 2
Views: 592
Reputation: 5745
DocumentDB does not support transactions , transactions were introduced to mongoDB in version 4.0 . DocumentDB only supports mongo version 3.6.
Atals in the mongo version in the cloud , https://www.mongodb.com/cloud/atlas.
that supports the newer versions of mongo that do have transactions.
Upvotes: 2