Unable to retrieve all documents from pouch db

23 views
Skip to first unread message

praveen kumar

unread,
Nov 8, 2016, 11:42:11 AM11/8/16
to PouchDB
Code:


function bynewId(db, newno) {
  return db.allDocs({
    include_docs: true,
    attachments: true
    }).then(function (result) {
    return result;
    }).catch(function (err) {
    error('Error occurred bynewId qry', JSON.stringify(err));
      });
}

Can someone help me.
And I also wanted to have a wild card search on _id and retrives the documents which matches the input string.

Bill Stephenson

unread,
Dec 1, 2016, 7:25:51 PM12/1/16
to PouchDB
Try this and see if it works for you:

// ---------------------------------------------------------------------------------------
function listDocs() {
// ---------------------------------------------------------------------------------------

var db = new PouchDB('dbname');
db.allDocs({include_docs: true}, function(err, doc) {

if (err) {
// oh noes! we got an error
document.getElementById("DocList").innerHTML=err;
console.log( "Error: loadList: " + err );

} else {
console.log( "Success: ");
for (var i in doc.rows) {

var id = doc.rows[i].id;

console.log( "Doc ID: " +id);
}
// There are no expense records in the data base. Time to make one!

}
});
}
Reply all
Reply to author
Forward
0 new messages