couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John <john.logs...@netdev.co.uk>
Subject Fwd: Linked Documents
Date Fri, 30 Jul 2010 18:32:30 GMT
Hi again

I didn't get any replies to this post so I'm going to boil it down to a simple question which
hopefully someone knows the answer to (positive or negative!):

Can the Design Document functions make database queries? 
e.g. If the validation method is being executed and it wants to check a referenced id, can
that be done?

Regards

John

Begin forwarded message:

> From: John <john.logsdon@netdev.co.uk>
> Date: 26 July 2010 22:38:17 GMT+01:00
> To: user@couchdb.apache.org
> Subject: Linked Documents
> 
> Hi
> 
> I have a Use Case where I store an Account Tree in the database. Each Account Node points
to its parent and I can resolve the tree using several database  queries by getting the account
then its parent then its parents parent, I guess you get the idea!
> 
> We store data as attributes in these account objects and inheritance is used to easily
propogate attributes down the account tree and override them at each node as required.
> 
> I've just been reading the wiki and seen a nice feature where I can emit index entries
with foreign id's which is great if I already know them in the doc my map function is working
on however I would prefer to just reference my parent and then *follow* that link to get the
parent doc and retrieve it's parent id from there.
> 
> So I guess what I'm trying to ask for here is whether I can retrieve another  document
from the database, by id, from within the map function in a view?
> I can see lots of other places in our design where this could be really useful especially
for validation of referenced id's within documents.
> 
> Thanks
> 
> John


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message