couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: HTTP request with CouchDB
Date Wed, 13 Nov 2013 16:10:58 GMT
oh i was confused by the function signature... Though well why not. In a
pure M/r (which we are not any way) i would forbid that,but for someone
that want to use maps as a way to provide transformed docs while keeping
the original doc, why not.... .  Until we are providing sane defaults.



- benoit


On Wed, Nov 13, 2013 at 4:59 PM, Robert Newson <rnewson@apache.org> wrote:

> Benoit, the code that makes an http call then uses the result in an
> emit() call, which only makes sense as part of a map function.
>
> B.
>
>
> On 13 November 2013 15:57, Benoit Chesneau <bchesneau@gmail.com> wrote:
> > On Wed, Nov 13, 2013 at 4:50 PM, Robert Newson <rnewson@apache.org>
> wrote:
> >
> >> what Jens said. We prevent this deliberately. Crowbar it back in at
> >> your own risk.
> >>
> >> B.
> >>
> >
> > The code pasted in the initial mail isn't about map/reduce but a show.
> Imo
> > if the user want to take more risk I don't see why not if it's feasible
> > technically without introducing any changes to the defaults ;) Especially
> > in shows and list. There are a lot of good reason to do that. we could
> even
> > provides some limitation on what could be cal there if i red the
> action.js
> > from 2008 well.
> >
> > - benoit
> >
> >
> >
> >>
> >>
> >> On 13 November 2013 15:45, Jens Alfke <jens@couchbase.com> wrote:
> >> >
> >> > On Nov 13, 2013, at 4:48 AM, Hank Knight <hknight555@gmail.com>
> wrote:
> >> >
> >> >> function(doc, req) {
> >> >>    var http = new XMLHttpRequest();
> >> >>    http.open( "GET", "http://www.w3schools.com/xml/note.xml", false
> );
> >> >>    http.send( null );
> >> >>    emit("xyz",http.responseText);
> >> >> }
> >> >
> >> > Wait, is that supposed to be a map function? Whether or not this is
> >> technically feasible, it’s an incorrect use of map/reduce.
> >> >
> >> > It’s critical that a map function be a ‘pure' function with no access
> to
> >> outside state. That is, every time the function is called with the same
> >> input, it must produce the same output. Otherwise you won’t get a
> >> self-consistent index.
> >> >
> >> > —Jens
> >>
>

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