How to deal with eventually consistent indexes - In a real app


I really like the indexing of Couchbase because of all the powerful thing you can do with it. I just have one big problem with it: The eventual consistency.

Let me give an example: Let’s say I’m tracking events for a specific object. Each event contains the id of the object it belongs to. When a object gets deleted, all events belonging to this object should get deleted as well.

Here is the Problem: I a event gets created just before the object gets deleted, it will not be deleted since I’m deleting the Objects using a n1ql query (delete from bucket where object_id=123). Is there a good practice on how to deal with this situation and be sure that all events get deleted ?

I just found, this solves my problem :slight_smile:

1 Like