couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: Foreign key checking?
Date Thu, 19 Nov 2009 00:08:01 GMT
On Wed, Nov 18, 2009 at 6:16 PM, Patrick Barnes <> wrote:
> I have a 'user', a 'group', and a 'role' doctype in my database.
> The user<->group relationship is many-to-many. (through the role)
> Roles have their own data (for instance, automatic expiry dates)
> When a role document is created, is there a way for validate_doc_update to
> check that the user and group the role refers to exist? I don't want orphan
> roles to be able to be created.

Assuming you're not deleting groups very often, check if it exists
before saving.

> (Alternatively: Is there a better way to do this?)
> -Patrick Barnes

Paul Davis

View raw message