views - How can I use a list function in CouchDB to generate a valid (/normal) ViewResults object? -


i have simple problem need solve, , list functions current attempt so. have view generates need, in cases there duplicate entries make through when send in edge-case parameters.

therefore, looking filter these results out. have found examples of filtering, using (see this post). however, rather generate html or xml or what-have-you, want regular ol' view result. is, same kind of object if queried couchdb without list function. should have json data normal , same in every way, except missing duplicate results.

any on appreciated! have tried send() data in quite few different ways, "no json object decoded", or indices need integers , not strings. tried use list store every row until end , send entire list object @ once.

example code (this using example from page send data:

function(head, req) {      var row; var dupes = [];     while(row=getrow()) {          if (dupes.indexof(row.key) == -1) {              dupes.push(row.key);              send(row.value);          }      };  } 

lastly, i'm using flask flask-couchdb, , i'm seeing aforementioned errors in flask development server i'm running.

thanks! can try supply more details if need be.

don't need prepend [, send , after each row value except last, , end ]? mimic view result, you'd need wrap in json structure:

{"total_rows":0,"offset":0,"rows":[<your stuff here>]} 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -