couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shipra Choudhary <>
Subject Erlang_Queries
Date Tue, 30 Jul 2019 08:10:01 GMT

I am trying to write a view in CouchDb by Erlang whatever the code I have
written in Design Document it is running successfully but I am not getting
the required result which I am expecting. That code is giving random result
of random doctype not for which I am asking.

  "_id": "_design/erl_views9",

  "_rev": "18-02fbdaca7ff5a7ef8aa0ec80a1b8f528",

  "language": "erlang",

  "views": {

      "getTemplates": {

      "map": "fun({Doc}) -> Id = couch_util:get_value(<<\"_id\">>, Doc),
Doc_type = couch_util:get_value(<<\"TEMPLATE\">>, Doc),Emit(Id, Doc_type)




 If I am using If in the code then It is giving error of Bad Query.

ERROR: Error running query. Reason: ({badmatch,[<<"error">>,
{1,erl_parse,["syntax error before: ","'end'"]}, {1,erl_parse,["syntax
error before: ","'end'"]}]})

What am I expecting ?

By passing particular key in doc_type and should get all the views
according to key value which I will pass in the function.

*Shipra Chaudhary*
*Software Engineer*

*+91 6390167803*
* <>*

  *Plot No. 5  **J V P Building,**4th Floor,**Madhapur,*

* Hyderabad, Telangana- 500081, India.*

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