Sync Gateway API to get all docs with a specific attribute

According to this link:, when i use get _all_docs, it can return channels and documents.

But what if the document can have some kind of my own attribute, let’s say myAttribute with some metadata of my own choice, and i want to retrieve them in the get _all_docs and avoid including the attachments. How can i do that?

you will nee to use views for that. go to admin API and check the query part. You will need to create a map reduce view , create a design document and then query the view. Its not like running N1QL.

Or if you want can get the documents by using N1QL also.


Do you know where i can get a N1QL for nodejs tutorial for couchbase? Im a bit confused since there are several inside the couchbase website.