incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Dynamic permanent views
Date Fri, 17 Jul 2009 12:57:26 GMT
Create a design document that looks like this:

{


On Fri, Jul 17, 2009 at 8:51 AM, <maillist@ol-mars.se> wrote:
> I'm trying to write a view that enables me to extract data from my couch
> depending on what variables I'm passing to it.
>
> Here is an example of what an entry in the db might look like:
>
>
> {
> "@type": "LocationHelperTest",
> "_id": "cad119d5abf74997a1dac4ca8ca6b266",
> "_rev": "2526720230",
> "name": "Test",
> "what": {
> "@new": 1,
> "@old": null,
> "@resource_id": "21716c48bc8211a522f0ac684acb1ea8"
> },
> "when": {
> "@recieved": "2009-07-17T07:08:04.765000"
> },
> "who": {
> "user_id": "user"
> },
> "why": {
> "new_state": "new state",
> "old_state": "old state",
> "reason": "A random reason"
> }
> }
>
>
> As you can see, I have a field, @resource_id, in the "what" dict. This
> is the same as the ID for another entry in the db that is called
> LocationTest. I'm using Pylons to write my system, and through the URL I
> get the ID. With this ID I want to find all LocationHelperTests with the
> @resource_id that matches this ID.
>
> How do I do this with views? (Or any other way if there is any). I'm not
> interested in temporary views, but wants a permanten view.
>

Mime
View raw message