A guard on one entity of a HasMany or HasAndBelongsToMany relationship.
A many-valued relationship has many possible targets, so the guard names one
by id. The write also verifies, in the same transaction, that the id is
actually related: a HasMany child's foreign key points at this entity, or the
HasAndBelongsToMany link exists.
Naming the same id twice in one relationship is a FilterError. An id that
is not related fails the write with a plain ConditionalCheckFailedError,
not a WriteConditionFailedError, inside the TransactionWriteFailedError.
Example
// Guard one of a Customer's Orders constorder: RelatedEntityCondition<Order> = { id:"order-1", condition: { total: { $lt:100 } } };
// Rename a Customer only while order-1 is theirs and still pending awaitCustomer.update( "customer-1", { name:"Jane Smith" }, { condition: { orders: [{ id:"order-1", condition: { status:"pending" } }] } } );
A guard on one entity of a HasMany or HasAndBelongsToMany relationship.
A many-valued relationship has many possible targets, so the guard names one by id. The write also verifies, in the same transaction, that the id is actually related: a HasMany child's foreign key points at this entity, or the HasAndBelongsToMany link exists.
Naming the same id twice in one relationship is a
FilterError. An id that is not related fails the write with a plainConditionalCheckFailedError, not aWriteConditionFailedError, inside theTransactionWriteFailedError.Example