incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pérès Vincent <vincent.pe...@gmail.com>
Subject Re: How to change/extend the show page of a document?
Date Sat, 13 Jun 2009 20:44:53 GMT
Thanks, I understand the aim :)

I also have another question about the relationship between documents. I
will take the example in "EntityRelationship" about groups and users. User
document store an array of groups ids. It's easy to fetch the users who
belongs to a group... but how to display the group details in the user
document?

ex :
http://localhost:5984/markers_development/_design/users/_view/full?key=vincent<http://localhost:5984/markers_development/_design/markers/_view/full?key=paris>

I would like to display my user document and the groups details he belongs
to.
Could you give me an example?

Thanks a lot !

On Sat, Jun 13, 2009 at 7:47 PM, Chris Anderson <jchris@apache.org> wrote:

> 2009/6/12 Pérès Vincent <vincent.peres@gmail.com>:
> > Hello,
> >
> > Thanks for your answer! So for the following URL :
> > http://localhost:5984/markers_development/_design/markers/_view/full
> >
> > I have the following results :
> >
> > {"total_rows":5,"offset":0,"rows":[
> >
> {"id":"6aa77856599e0fd0b3e84e1369c7cdfb","key":"6aa77856599e0fd0b3e84e1369c7cdfb","value":{"name":"lyon"}},
> >
> {"id":"b04d2d2524c8adf5075fbf5e1bae2118","key":"b04d2d2524c8adf5075fbf5e1bae2118","value":{"name":"Strasbourg"}},
> >
> {"id":"d0d2605d5ccbf6e0726d7604279cad70","key":"d0d2605d5ccbf6e0726d7604279cad70","value":{"name":"Paris"}},
> >
> {"id":"df8144f371bc9ef5e49c7499ea7c0dc3","key":"df8144f371bc9ef5e49c7499ea7c0dc3","value":{"name":"Strasbourg"}},
> > {"id":"paris","key":"paris","value":{"name":"Paris"}}
> > ]}
> >
> > But with :
> >
> http://localhost:5984/markers_development/_design/markers/_view/full?key=paris
> >
> > I got the following error :
> >
> http://localhost:5984/markers_development/_design/markers/_view/full?key=paris
> >
> > -------
> >
> > Wow I just resolve the issue by using quote for the key :
> >
> http://localhost:5984/markers_development/_design/markers/_view/full?key=%22paris%22
> >
>
> For future reference the quotes are necessary because the key can be
> any JSON object not just a string, which gives even more flexibility.
>
> Enjoy!
>
> > It's working, thanks to you :)
> >
> > Vincent
> >
> > On Fri, Jun 12, 2009 at 11:23 PM, Dmitry Unkovsky <oil.crayons@gmail.com
> >wrote:
> >
> >> I'm new to couchdb, but as I recall, view can accept number of
> >> parameters, you can see them here -
> >>
> >>
> http://wiki.apache.org/couchdb/HTTP_view_API#head-d288caa8951ff266fb230d364e5c690c4fd7a28a
> >>
> >> Hope that helps.
> >>
> >
>
>
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>

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