couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CGS <cgsmcml...@gmail.com>
Subject Re: Problem with / in _design doc _id & filters?
Date Fri, 22 Jun 2012 10:25:41 GMT
This is AJAX request and I don't suppose it will be changed soon. As long
as CouchDB will answer with a JSON, it will be a valid request (you do ask
for the contentType to be application/json), I suppose. What you did there
is nothing else but attaching the data object to the provided url which GET
method in jQuery AJAX should do it for you otherwise.

About the leading "_design", my bad and I apologize for that.

Good luck!
CGS





On Fri, Jun 22, 2012 at 11:51 AM, Gregor Martynus <gregor@martynus.net>wrote:

> that worked! I took me a while to understand who to reproduce that in the
> browser now, until I wrapped the query in quotes:
>
> $.ajax({
>  url: '/test/_changes?"filter=_design%2fa%2fb/test"',
>  contentType: 'application/json'
> })
>
>
> It also works without the leading _design %2fa
>
> $.ajax({
>  url: '/test/_changes?"filter=a%2fb/test"',
>  contentType: 'application/json'
> })
>
> Passing JSON as the query did the trick as well
>
> $.ajax({
>  url: '/test/_changes?\'{"filter":"a%2fb/test"}\'',
>  contentType: 'application/json'
> })
>
>
> didn't even need to make it valid JSON
>
> $.ajax({
>  url: '/test/_changes?"{filter:a%2fb/test}"',
>  contentType: 'application/json'
> })
>
>
> wow, all of the sudden it's hard to find something that does not work.
> Do you know if all these are supported on purpose? Or should I rather
> stick with passing valid JSON as String to assure future compatibility?
>
>
> --
> Gregor Martynus
>
>
> On Thursday, 21. June 2012 at 22:55, CGS wrote:
>
> > Try this:
> >
> > curl -X GET http://127.0.0.1:5984/test/_changes -d
> > '{"filter":"_design%2fa%2fb/test"}' -H 'Content-Type: application/json'
> >
> > CGS
> >
> >
> >
> >
> > On Thu, Jun 21, 2012 at 7:43 PM, Gregor Martynus <gregor@martynus.net(mailto:
> gregor@martynus.net)>wrote:
> >
> > > no luck … does it work for you?
> > >
> > > --
> > > Gregor Martynus
> > >
> > >
> > > On Thursday, 21. June 2012 at 19:02, CGS wrote:
> > >
> > > > Try encoding all the slashes.
> > > >
> > > > CGS
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, Jun 21, 2012 at 4:29 PM, Gregor Martynus <
> gregor@martynus.net (mailto:gregor@martynus.net)(mailto:
> > > gregor@martynus.net (mailto:gregor@martynus.net))>wrote:
> > > >
> > > > > When I create a _design doc with a / in it, I'm not able to refer
> to
> > > its
> > > > > filter in the _changes feed.
> > > > >
> > > > > Example _design doc:
> > > > > {
> > > > > "_id": "_design/a/b",
> > > > > "filters": {
> > > > > "test": "function(doc) { return true; };"
> > > > > }
> > > > > }
> > > > >
> > > > >
> > > > > _changes request:
> > > > > GET http://localhost:5984/test/_changes?filter=a%2fb/test
> > > > >
> > > > >
> > > > > returns a 400 with the body:
> > > > > {
> > > > > error: "bad_request",
> > > > > reason: "filter parameter must be of the form
> `designname/filtername`"
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > Is this a bug? Or am I doing something wrong?
> > > > > I test it without the / in the _design doc, it worked without a
> problem
> > > > >
> > > > > --
> > > > > Gregor Martynus
> > > > >
> > > >
> > >
> > >
> >
> >
> >
>
>
>

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