1

In Node, using Express and Cradle, I have a call to a _list that does not work. Other calls go to _view and work fine. The Cradle documentation does not include a section on _list but it seems from this GitHub readme that it is supposed to work just like _view.

My code looks like:

if(isList){
    db.list(couch_url, function (err, res) {
        if(err){
            console.log("error couchdb list", err);
        }else{
            //console.log(res);
            callback(JSON.stringify(res));
        }
    });     
}

The couch_url variable is just the regular http request and looks like: myCouch/_design/Model3D/_list/convert/All except the path designators (_design, _view, _list) have been removed to get Model3D/convert/All for Cradle (it looks like they are put back in the Cradle function). That full path represented by couch_url will work in other CouchDB connections, and like I said, the Cradle view function works fine.

The error object I get is:

{ stack: [Getter/Setter],
    arguments: [ 'ILLEGAL' ],
    type: 'unexpected_token',
    message: [Getter/Setter] }
Perry Krug
  • 665
  • 4
  • 6
KTys
  • 170
  • 1
  • 9

2 Answers2

0

I tried to reproduce this, but it seems to work for me. Just double checking is "convert" your list function and "All" your view name?

The only other caveat I am seeing is that your database name has a capital case character in it. CouchDB databases must be all lowercase.

Jan Lehnardt
  • 2,619
  • 1
  • 17
  • 14
  • Jan - can you give me the couchdb and cradle versions you used successfully? There may be some rule about capitalization - but all my other couchdb-related calls work fine with that database name, so its hard to believe that would mess up just the _list function... – KTys Sep 09 '11 at 21:06
  • Also, the names are in proper couchdb order - I know it because if I use any of several other non-cradle routes (perl, curl), it works. – KTys Sep 09 '11 at 21:17
0

Check the list function you are using - it is highly likely to be producing broken JSON. In my case, I was getting a result of 'undefined' for a property. Anything undefined should be dropped, and all property names should be in quotes