couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Heilig <d...@heilig-online.com>
Subject Re: Comments in design doucment
Date Fri, 24 Feb 2012 23:12:48 GMT
Hi Ian,
i don't get the point.
i comment my map / reduce functions just like i comment all my other
code in ohrer places, like this:

//this is my map function to map all docs
function(doc) {
  //i jost emit every doc
  emit(null, doc);
}

which results in a valid json like this:


{
   "_id": "_design/delme",
   "_rev": "1-bed099dd4d01031ac4c177f5d7acf372",
   "language": "javascript",
   "views": {
       "delme": {
           "map": "//this is my map function to map all
docs\nfunction(doc) {\n  //i jost emit every doc\n  emit(null,
doc);\n}"
       }
   }
}


in my opinion thats the right way, because i'am commenting the code,
not the data..

dirk
2012/2/24 Ian Mayo <ian@planetmayo.com>:
> thanks for the advice chaps.
>
> I now realise this isn't something CouchDb specific, it's JSON
> specific.  The workaround is to add a comment as a field, as described
> here:
> http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
>
>
> On 23 February 2012 15:44, Ian Mayo <ian@planetmayo.com> wrote:
>> Hi all,
>> like a good software engineer I'm trying to document my code.
>>
>> But, each time I try to put a // or /* comment into my design document
>> the transfer to couchdb fails.
>>
>> Is there a way of putting comments into a design document?
>>
>> cheers,
>> Ian

Mime
View raw message