Iterating through all the documents with couchdb

19 views
Skip to first unread message

Eric Chaland

unread,
Mar 3, 2017, 9:49:50 PM3/3/17
to LightCouch
Hello,
I need to retrieve all the documents for a couchdb in a sequential manner. I'm trying to use the pagination as follow, but I get the error message below:

Page<JsonObject> page = dbClient.view("_all_docs").includeDocs(true).queryPage(10,null,JsonObject.class);
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT


However, when I run the line below, it works fine:
List<JsonObject> allDocs = dbClient.view("_all_docs").includeDocs(true).query(JsonObject.class);  

What class name should I use for the queryPage function. Documents are stored in the database as Json objects. 

Thanks in advance for your help.

LightCouch

unread,
Mar 4, 2017, 11:43:02 PM3/4/17
to LightCouch
The queryPage() will Not work for _all_docs view, currently it works for views with keys defined only as Strings.
Reply all
Reply to author
Forward
0 new messages