You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by hp lw <ip...@gmail.com> on 2011/02/26 17:08:54 UTC

trouble with lists

Hi!
I have a trouble with creating lists functions in Futon. When I write it in
readable form like
{
   "test": "function(head,req){
          start({ headers:{'Content-type':'text/html'}});
          while(row=getRow()){
                send('<div>');
                send(row.value['created_at']+' :
'+row.value['member_id']);
                send('</div>');
         }"
}

I'm always getting error about sintax, and Fields(Design)  function is shown
as a text without highlighting function name. but when I write
all-in-one-line it works ok.
{
   "test": "function(head,req){ start({ headers:{'Content-type':'text/
html'}});while(row=getRow()){send('<div>');send(row.value['created_at']
+' : '+row.value['member_id']);send('</div>');}"
}

What am I doing wrong?
P.S. everthing was fine until I upgrade from 0.8 to 1.02

Re: trouble with lists

Posted by David Rose <do...@gmail.com>.
I'm pretty sure newlines in a string is not valid JSON (or Javascript,
for that matter).

David Rose

On Sat, Feb 26, 2011 at 10:08 AM, hp lw <ip...@gmail.com> wrote:
> Hi!
> I have a trouble with creating lists functions in Futon. When I write it in
> readable form like
> {
>   "test": "function(head,req){
>          start({ headers:{'Content-type':'text/html'}});
>          while(row=getRow()){
>                send('<div>');
>                send(row.value['created_at']+' :
> '+row.value['member_id']);
>                send('</div>');
>         }"
> }
>
> I'm always getting error about sintax, and Fields(Design)  function is shown
> as a text without highlighting function name. but when I write
> all-in-one-line it works ok.
> {
>   "test": "function(head,req){ start({ headers:{'Content-type':'text/
> html'}});while(row=getRow()){send('<div>');send(row.value['created_at']
> +' : '+row.value['member_id']);send('</div>');}"
> }
>
> What am I doing wrong?
> P.S. everthing was fine until I upgrade from 0.8 to 1.02
>

RE: trouble with lists

Posted by Nils Breunese <N....@vpro.nl>.
There have been a couple of API changes between 0.8 and 1.0.2: http://wiki.apache.org/couchdb/Breaking_changes

Nils.
________________________________________
Van: hp lw [ipaq.lw@gmail.com]
Verzonden: zaterdag 26 februari 2011 17:08
Aan: user@couchdb.apache.org
Onderwerp: trouble with lists

Hi!
I have a trouble with creating lists functions in Futon. When I write it in
readable form like
{
   "test": "function(head,req){
          start({ headers:{'Content-type':'text/html'}});
          while(row=getRow()){
                send('<div>');
                send(row.value['created_at']+' :
'+row.value['member_id']);
                send('</div>');
         }"
}

I'm always getting error about sintax, and Fields(Design)  function is shown
as a text without highlighting function name. but when I write
all-in-one-line it works ok.
{
   "test": "function(head,req){ start({ headers:{'Content-type':'text/
html'}});while(row=getRow()){send('<div>');send(row.value['created_at']
+' : '+row.value['member_id']);send('</div>');}"
}

What am I doing wrong?
P.S. everthing was fine until I upgrade from 0.8 to 1.02
------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------