views:

994

answers:

3

I am already excited about document databases and especially about CouchDB's simplicity. But I have a hard time understanding if such databases are a viable option for multi user systems. Since those systems require some kind of relations between records which document databases do not provide.

Is it completely the wrong tool for such cases? Or some tagging and temporary views are the way to accomplish this? Or else...

UPDATE:
I understand the answers so far. But let me rephrase the question a bit. Lets say I have a load of semi-structured data which is normally a fit for CouchDB. I can tag them like "type=post" and "year=2008". My question is how far can I go with this type of tagging? Say can I create an array field with 10.000 names in it? Or is there a better way of doing this? It is a matter of understanding how to think in this document based sense.

+3  A: 

Multi-user systems do not require relational databases, though RDBMSs are a staple technology for data storage/retrieval for a vast number of (especially CRUD) applications.

If you want to read-up on document/object -oriented, distributed database solutions of yore, search on "Lotus Notes/Domino" (it's a mature technology/product in this area that's good background knowledge in how applications are designed in a document-based paradigm. Classically, it's really good at workflow type applications).

On CouchDB specifically, check out:

http://wiki.apache.org/couchdb/ (this shouldn't be a surprise)

http://seanoc.wordpress.com/2007/10/12/more-on-couchdb/ (easy reading description overview)

http://twit.tv/floss36 (Podcast interview all about CouchDB)

micahwittman
+2  A: 

What @micahwittman says. Just a quick addition: Temp views should never be used in a production system, they are for development only. Permanent views can do everything temp views can do and are magnitudes faster.

Jan Lehnardt
+3  A: 

There was a discussion on the mailing list awhile back that fits this question fairly well. The rule of thumb was to only store data in a document that is likely to change vs. grow. If the data is more likely to grow then you most likely want to store separate docs.

So in the case of a multi-user system one way of implementing ACL based permissions could be to create 'permission docs' that would be a mapping of user_id to doc_id with the appropriate permission indicated.

{
    _id: "permission_doc_1",
    type: "acl",
    user: "John",
    docid: "John's Account Info",
    read: true,
    write: true
}

And your views would be something along the lines of

function(doc)
{
    emit([doc.user, doc.docid], {"read": doc.read, "write": doc.write});
}

And given a docid and userid, checking for permissions would be:

http://localhost:5984/db/_view/permissions/all?key=["John", "John's Account Info"]

Obviously, this would require having some intermediary between the client and couch to make sure permissions were enforced.

Paul J. Davis