Reputation: 115
First, I'm using couchdb4j. Normally if we want to traverse the couchdb, we put the whole database into a view by using the
ViewResults results = db.getAllDocuments()
But my database is about 1 Gb with about 110000 rows, so it is too big to put the whole database into the ViewResults List. My document id is default(that's my bad, I should have set id numbers like 1,2,3...). So, I'm just wondering is there a way to traverse the whole documents without putting them all into a view? Or, is there a way that I can export the whole database into a csv file? Thanks.
Upvotes: 1
Views: 189
Reputation: 1225
So, I'm just wondering is there a way to traverse the whole documents without putting them all into a view?
Yes. You can paginate the results of your requests by using the query parameters ?skip=...&limit=...
You will request batches of the primary index /_all_docs
. Every response inherits the informations you need to request the next batch. Here is an example response:
{
"total_rows":12345,
"offset":500, // the current position
"rows" :[{...}]
}
Upvotes: 1