incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: Problem using Views
Date Wed, 17 Mar 2010 20:18:47 GMT
On Wed, Mar 17, 2010 at 03:01:27PM -0500, Jeffrey Ollie wrote:
> On Wed, Mar 17, 2010 at 12:31 PM, Jeffrey Ollie <jeff@ocjtech.us> wrote:
> >
> > function(doc) {
> >  if (doc.record_type ==
> > "http://www.geocaching.com/track/details.aspx" && !(typeof
> > doc.location === "undefined")) {
> >    emit(doc.location, null);
> >  }
> > }
> 
> Ok, I'm confused...  The above works fine as the map function for a
> temporary view, but fails when it's used as a permanent view.  Even if
> I go into Futon and enter the code into the temporary view, check that
> it runs, and then use the "save as" button to convert it to a
> permanent view I get the "Cannot encode 'undefined' value as JSON"
> error.  What am I missing here?

I don't really know, but try this as a first stab at isolating the problem:

  emit(doc.location || "oops", null);

If you're still getting the 'undefined as JSON' error then it could be
something tangential like looking at the wrong view. Try using curl -v as
the client, as that eliminates any uncertainty about your HTTP client.

Mime
View raw message