Key-value operations are much faster than query operations. If you asked me for a number, I would say 20 times faster.
I am not seeing a way to search for documents and return a list of keys. I don’t see a way to iterate over all the documents in a collect.
Here is one way to get document keys - How to quickly list 1M document identifiers?
Here is another - python - how to get all the key from one bucket in couchbase? - Stack Overflow ( using map/reduce ).
Detailed instructions for using map/reduce :
Here’s the easy/quick way to get the ids.
- go to the couchbase webconsole
- select “Views”
- Click on “Add View”
- Complete Design Document Name with “allids” (giving design/dev)
- Enter View Name as “getids”
- Click on Save
- Click on Publish for the View.
- curl -u Administrator:password ‘http://localhost:8092/my_bucket/_design/allids/_view/getids?reduce=false’ > allids
The default Map without any Reduce gives all the ids in the bucket.
{"id":"999993","key":"999993","value":null}, {"id":"999994","key":"999994","value":null}, {"id":"999995","key":"999995","value":null}, {"id":"999996","key":"999996","value":null}, {"id":"999997","key":"999997","value":null}, {"id":"999998","key":"999998","value":null},
There is an upcoming feature - range-scan - that will also provide document keys.