ACID Feature in 6.5 Version..any relation with concurrency?

Hello Members…I am working in a feature where Multiple users may access the same sub-section and document at same point of time. For example, there is market inventory document having multiple products (as sub-section)…and different counter is updating the same document/same sub-section simultaneously. To be precise, in the document, there is a product i.e. ‘P1’ having an attribute ‘Quantity in Hand’. ‘P1’ is available in multiple counter i.e. C1,C2 for sell.

So, there may be use case where both counter C1, C2 would access the same sub-section of the document (i.e. P1 section) simultaneously and update ‘Quantity in Hand’ attribute.

So, both the counter accessed the document having initial value as ‘Quantity in Hand’ = 5.

Now C1 has sold 2 units and C2 sold1 unit. After both C1,C2 updated the document, ideal scenario would be ‘Quantity in Hand’ = 3.

But we know the update latter happened persists. Now if C2 update happens later than C1 update, ‘Quantity in Hand’ would be 4 instead of 3. But this is not correct.

How to avoid this situation??

Hey @DibyenduM
So I don’t completely understand your document model from the description, but it sounds like you need the Couchbase optimistic locking primitive “CAS” rather than the transactions feature added in 6.5.

You can read up on CAS here:
Please let me know if this addresses your need, or if you’d like more information.