Alex Parker
Alex Parker

Reputation: 1583

Retrieve all documents but only specific fields from Cloudant database

I want to return all the documents in a Cloudant database but only include some of the fields. I know that you can make a GET request against https://$USERNAME.cloudant.com/$DATABASE/_all_docs, but there doesn't seem to be a way to select only certain fields.

Alternatively , you can POST to /db/_find and include selector and fields in the JSON body. However, is there a universal selector, similar to SELECT * in SQL databases?

Upvotes: 0

Views: 1683

Answers (1)

rhyshort
rhyshort

Reputation: 1453

You can use {"_id":{"$gt":0}} as your selector to match all the documents, although you should note that it is not going to be performant on large data sets.

Upvotes: 2

Related Questions