couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Le Brasseur <johnlebrass...@gmail.com>
Subject Filtered Replication
Date Wed, 08 Feb 2017 08:23:40 GMT
Hi.
Can anyone tell me why this works:

{
  "_id": "_design/first_filter",
  "_rev": "24-a6c1822c543f96d1bf4803112092e9ae",
  "filters": {
    "filter1": "function(doc, req) {if (doc.abc === \"xyz\") {return
true;}else{return false;}}"
  },
  "language": "javascript"
}



and this does not:

{
  "_id": "_design/first_filter",
  "_rev": "24-a6c1822c543f96d1bf4803112092e9ae",
  "filters": {
    "filter1": "function(doc, req) {if (doc.def.ghi === \"jkl\") {return
true;}else{return false;}}"
  },
  "language": "javascript"
}


In the second case I get:

[error] 2017-02-07T18:55:40.384000Z couchdb@localhost <0.32487.361>
f201ca664a OS Process Error <0.18298.118> ::
{<<"TypeError">>,{[{<<"message">>,<<"doc.def is undefined">>}



I'm using v2.0.0 on Windows and running a filtered replication using curl.

The documents contain the relevant structure and all documents contain
"abc", and "def.ghi" and have values.

Many thanks.

John

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