incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Nicollet <vnicol...@runorg.com>
Subject Re: first view problem badmatch
Date Tue, 23 Aug 2011 08:45:31 GMT
Hello,

In JSON, you need to place quotes around field names, so the correct value
for the views field should be:

  {
    "all": {
      "map" : "function(doc) { emit(doc._id,doc); }"
    }
  }

If the quotes are missing, Futon will detect a syntax error and save the
field value as a string, and CouchDB will complain that it expected a
non-string value.
.
On 23 August 2011 10:36, gaoyong pan <pan.gaoyong@gmail.com> wrote:

> I'm trying my first view with url
> http://localhost:5984/qq/_design/application/_view/all, the code is,
>
> _id :   _design/application
> _rev:   8-70c13aeee55e3ba8400f2068f11d9156
> views: {
>            all: {
>              map: "function(doc) {
>               emit(doc._id,doc);
>              }"
>            }
>          }
>
> and the error is below, can anyone tell what's the issue here?
>
> {"error":"badmatch","reason":"{ \n  all: {\n    map: \"function(doc)
> {\n     emit(doc._id,doc);\n    }\"\n  }\n}"}
> --
> Pan
>

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