couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen van Dijk <jeroentjevand...@gmail.com>
Subject Re: How to use the changes feed with a view as filter
Date Mon, 08 Aug 2011 12:43:03 GMT
On Mon, Aug 8, 2011 at 2:17 PM, Sean Copenhaver
<sean.copenhaver@gmail.com>wrote:

> Oh wow, I was unaware that you could filter by view. The code indeed makes
> it look that way. I'm not sure which release this was done in though, or if
> you would need to build from latest source.
>
> Anyway, the code makes me think the request would be more like this:
> GET
>
> http://myaccount.iriscouch.com/mydb/_change?filter=_view&view=_design/mydb/_view/my_view
>
>

Actually the following seems to be more of what I want, but apparently I'm
not calling it correctly:

GET
http://myaccount.iriscouch.com/mydb/_changes?filter=view&view=myview/my_view
=> {"error":"bad_request","reason":"filter parameter must be of the form
`designname/filtername`"}



> I get that from here:
>
> https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_changes.erl#L144
>
> Looks like those function clauses are to define the different built in
> filters plus the last one to catch custom ones. The one on that line looks
> like what you are after and it's expecting a 'view' query string parameter
> I
> think.
>
> I believe the _design filter is to monitor for when a design document
> changes and not to filter by a function inside of it. I don't have anything
> setup to test this though.
>

I think you are right.


>
> Hopefully someone with not knowledge is able to confirm this and which
> release this was in
>

Yes please. I think it is a 1.1 feature, but maybe you can only filter on
doc ids and design docs:
https://github.com/apache/couchdb/blob/trunk/CHANGES#L63

This is the original thread that gave me the impression it should be
possible: http://comments.gmane.org/gmane.comp.db.couchdb.user/13364


On Mon, Aug 8, 2011 at 7:32 AM, Jeroen van Dijk
> <jeroentjevandijk@gmail.com>wrote:
>
> > I've tried to run the changes feed on a specific view, but so far I
> haven't
> > succeeded. I'm only able to use the 'doc_ids' filter, but I can't filter
> > using a view.
> >
> > I've tried the following requests (using IrisCouch, couchdb version 1.1):
> >
> >    GET
> > http://myaccount.iriscouch.com/mydb/_changes?filter=_doc_ids&doc_ids=[
> > "_design/mydb/_view/my_view]
> >    GET
> >
> http://myaccount.iriscouch.com/mydb/_changes?filter=_design&design=_design/mydb/_view/my_view
> >
> > Both give me the same result whereas I would expect the 'filter=_design'
> >  to give me the result of the map function and not the changes of the
> design
> > document itself. The second request also works without the design
> parameter:
> >
> >    GET http://myaccount.iriscouch.com/mydb/_changes?filter=_design
> >
> > I think that also indicates I am doing something wrong. Anyone knows how
> to
> > get this working?
> >
> > Thanks,
> >
> > Jeroen
> >
> >
> > NB. My Erlang is not good enough to understand what exactly happens here:
> >
> https://svn.apache.org/repos/asf/couchdb/tags/1.1.0/src/couchdb/couch_changes.erl
>
>
>
>
> --
> “The limits of language are the limits of one's world. “ -Ludwig von
> Wittgenstein
>

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