简体   繁体   中英

How to get all documents from couchdb using lightcouch api in java

Is there any way to get all documents from a db rather than specifying an id and retrieving a single document using lightcouch api in Java.Presently i am using the method

JsonObject json = dbClient.find(JsonObject.class, "some-id") to retrieve a single document.

Thanks in advance.

How about the _all_docs view? That will return a list of all the docs in the database. Or if you include include_docs=true to the request, you will also get the contents of the documents.

Try this... use a view that emits documents, but don't send any key values. There is a chance you will get all the documents of the type you specified. Also, a warning... if you use a LightCouch view, you might need to retrieve the id's of your documents, then get your actual data by "finding" it using those id's.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM