in Couchbase DB, is it possible to retrieve multiple documents using key prefix as query string, and it returns all the key-values which has key starting with supplied key prefix (like operator kind of thing)? without using Views or queries/indices.
I am designing my keys the way it is shown in Slide 51 of this presentation http://www.slideshare.net/Couchbase/couchbase-103-data-modeling
If you don't want to use a view or n1ql query, there is no way to retrieve documents without knowing their exact keys. That is, you can only retrieve your prefix-based keys if you have a way to generate the possible keys on the client side in advance, e.g. User-1, User-2 ... User-n.
You can, however, do the sort of prefix query you're talking about in n1ql without creating any additional indexes, because with n1ql you will already have a primary index on all the document keys. So you can do something like "SELECT META(myBucket).id FROM myBucket WHERE META(myBucket).id LIKE "prefix%";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With