You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Behrad Zari <be...@yahoo.com> on 2010/05/09 13:52:25 UTC
Using views in Validation functions
Consider implementing a MailBox scenario on top of CouchDB, where we should manage user box quota size.
If we create a doc for each user, and represent a message with a doc that references user doc NOW:
For quota size control, I was thinking to use validation functions but it seems they have only access to the to-be-created/updated doc, but we need access to all docs/msgs (to collect attachment sizes) referenced to the user, and this can happen by a map/reduce function!
Any helps/suggestions/workarounds would be thankful!
--Behrad
Re: Using views in Validation functions
Posted by Zachary Zolton <za...@gmail.com>.
I'd suggest having a database per user. That makes both access control
and size/usage easy.
I'd consider limiting the user access to the database via a middle
tier program that can just check the database size before allowing any
write operations.
And don't worry, CouchDB is known to support tens of thousands of databases.
—Zach
On Sun, May 9, 2010 at 6:52 AM, Behrad Zari <be...@yahoo.com> wrote:
> Consider implementing a MailBox scenario on top of CouchDB, where we should manage user box quota size.
> If we create a doc for each user, and represent a message with a doc that references user doc NOW:
> For quota size control, I was thinking to use validation functions but it seems they have only access to the to-be-created/updated doc, but we need access to all docs/msgs (to collect attachment sizes) referenced to the user, and this can happen by a map/reduce function!
>
> Any helps/suggestions/workarounds would be thankful!
>
> --Behrad
>
>
>