Hi, I have a particular use case where I have two types of documents, let’s call the first A and the second B, that have a one to many relationship as follows:
A: {
references: [“b_id1”, “b_id2”…]
}
B: {
…
}
Obviously ‘references’ array contains the list of the ids of related B items.
When I create a document B referenced to a document A I want his id to be added to the references array, and when I’ll delete it, I want it to be removed.
How can I do this without sending two different requests to the server (one for creation/deletion, handled by Couchbase for NodeJS SDK, and one for array handling on ‘references’)? I’m worried because If I send these two statements and one of them fails, I’ll have a consistency lack in my dataset.
Is there any way to reproduce ‘ON CASCADE’ statements of foreign keys of SQL?