Search code examples
couchdbcouchdb-futon

adding comments to a couchdb design doc


Is there a way to enter comments into a couchdb design doc?

The queries can get pretty cryptic, and it would be really nice to be able to write a brief human description of what they do.


Solution

  • If you want to add comments to your JS code, that's fine.

    function (doc) {
      // comments are ok here
      if (doc.type === 'user') emit(doc.username);
    }
    

    However, you can't add comments to the outer JSON, since JSON doesn't support comments.

    {
      "views": {
        "by-name": {
          // you can't put comments here
          "map": "function (doc) { ..."
        }
      }
    }