title: Couchdb update handlers
body: <p>Following: <a href="https://stackoverflow.com/questions/2972068/couchdb-document-update-handlers-in-place-updates">CouchDB Document Update Handlers (in-place updates)</a> and <a href="http://wiki.apache.org/couchdb/Document_Update_Handlers" rel="nofollow noreferrer">http://wiki.apache.org/couchdb/Document_Update_Handlers</a></p>
  
  <p>I'm trying to create my own function which increment an integer for now, but I'm getting:</p>
  
  <p><strong>{"error":"bad_request","reason":"Attachment name can't start with '_'"}</strong></p>
  
  <p>My design document looks like: _design/db</p>
  
  <pre><code>  "check": {
          "increment": "function(doc,req){ var channel = req.query.channel; doc.channels[0].sp = doc.channels[0].sp+1;  return[channel, 'check']}"
      }
  </code></pre>
  
  <p>And the request is like:</p>
  
  <pre><code>curl -X PUT https://server/db/_design/db/_check/increment/channels?channel=foo
  </code></pre>
  
  <p>I don't understand very well what I'm doing wrong, if I remove the '_' I will get:</p>
  
  <p><strong>{"error":"conflict","reason":"Document update conflict."}</strong></p>
  
  <p>Thanks</p>