Search code examples
erlangcouchdbcouchdb-2.0

How to create Erlang Views in CouchDB


I'm trying to translate my couchdb views to Erlang due to the multiple couchjs process running on my server.

I navigated through some tutorials and some stackoverflow questions but I didn't see anyone talk about the place where I should type the code and press the save button (or the http api). The old docs talked about temporary views, but it seems that this feature does not exist in couchdb 2.1.

I already enabled the native-erlang-query-server

EDIT: I tried changing the language and I got this error. Just changing the content-type to multipart/form-data did not work either enter image description here

EDIT2: Worked with PUT as Juanjo Rodriguez said


Solution

  • Once you have enabled the erlang query server you need to create your design docs setting the language as erlang.

    {
      "_id": "_design/test-erlang",
      "language": "erlang",
      ...
    }
    

    Here you have the set of operations you can use in the erlang design doc functions.