On Jan 2, 2014, at 9:26 AM, Pascal 
<[email protected]<mailto:[email protected]>> wrote:

To answer my own question, maybe this is useful to somebody else: it seems 
handling deletion of dependent documents (for example a one-to-many 
relationship between people and note documents belonging to somebody) is best 
done in a validation block.

I’m a nervous about the idea of a validation block making changes to the 
database, for instance if your -didDelete method ends up deleting other 
documents. It will trigger a re-entrant call to the document-updating code, and 
I’m not sure that will behave correctly in all cases.

It would be safest if you delayed the call to -didDelete, e.g. by putting it in 
a dispatch_async block.

For some reason, newRevision.properties was always null, hence I'm using 
newRevision.document.

Deleting a document creates a revision with no properties (except a magic 
“_deleted”:true tombstone.) If you want to look at the properties of the 
existing revision, look at oldRevision.properties.

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/A9F21408-A250-4DE1-86BF-2B8265E6B8C1%40couchbase.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to