Tuesday 15 February 2011

couchdb - Couch DB escape characters -


I have a list function for CouchDBee, but I can not get it in DB because I continuously get the syntax erros. Here is the function:

  function (head, rick) {var header; Start ({'Headers': {'Content-Type': 'Text / CSV; Charset = UTF-8; Header = Current'}}); While (r = getRow ()) {if (header!) {Header = object.quote (rw); Send ('' + 'headers.join (' ", '') + '" \ n');} for header. (Work (v, i) {send (string (r.value [v]). Replace (/ \ "/ g, '' '). Replace (/ ^ | $ / g,' '')); (I + 1  

Can I show an example of this FORFATT function that can be inserted in Cochindi?

< P>

List functions are stored in design documents. Design documents are JSON documents, so you have to make sure that they are of JSON standard Since the list function contains string values ​​in JSON, you need to make sure that you:

  • Avoid any double quotes in the function, so " If possible, you should use a single quote instead of double quotes.
  • Make sure you enter \ n Replace any line breaks with or simply remove line breaks because JavaScript It also neglects in any way.
  • To save any backslash so that \ becomes \\ .

No comments:

Post a Comment