I guess this is a pretty generic NoSQL question, but I figured this would be a reasonable list to ask it on.
I'm trying to figure out how to model a mailbox scenario with Couch. The idea is that you have users, mailboxes, and mail sources. A user can have multiple mailboxes, and each mailbox is fed by a mail source. Each mail source feeds multiple mailboxes. Users have control over their mailboxes; they can create a mailbox associated with a single mail source, and they can delete their mailboxes when they feel like it. In SQL, I'd have three main tables: Users, Mailboxes, MailSources. Between Users and Mailboxes would be a mapping table, and between MailBoxes and MailSources would be another mapping table. When a user deletes a mailbox, the relation between that mailbox and its source is automatically cleaned up by the database's internal logic. How can that action be done in CouchDb? How would a person model this entire thing in CouchDb? Would you basically have the same three tables for the data, the same two mapping tables for user's mailboxes and mailboxes' subscriptions, and have application-level logic to manage the cascading deletes, or is there a better way?
