To my knowledge that, Couchbase doesn’t currently support transactions on the DB level, and the most promising way to keep ACID seems to using single document with nested object. But I still wonder if there is best practice to accomplish “transactions” on the application level if I have to keep things a little more separated. let say we will need to store “question” and “answer” objects that each question will have an array of ids to links to answers, and I am using node js SDK. I will probably end up having code like this.
var answer = {id : “answer_1”, content: “answer”}
bucket.insert(“answer_1”, answer, function(){
bucket.mutateIn(‘questoin_1’).upsert(‘answers’, [answer.id], true).execute…
})
the potential problem with this approach is that if the first request succeed and the second one failed, we will end up having an answer object that we will not be able to access. So any thought on this? Thanks.