Query Docuemnts without view

query

#1

What I’m interested in is to query documents in a bucket without need for creating views.
On Couchbase web console (already version 2.2) I’m able to filter documents by typing whatever value in search field (I was about to put screen here but since I’m a new user I can put only one image in post).
When you go to Data Buckets -> {bucket name} -> Documents button (on the right) -> search field.

And somehow Couchbase is able to take that value and query server for documents in a given key range.

Is there a way to do the same with Java SDK? Since functionality is already there, implemented on server side why not to give folks chance to use it from code?
Need for creating view that will emit everything seems kinda cumbersome.


#2

This was an unsupported undocumented feature of the 2.2 server to support the webconsole. I believe it has been removed from 3.0 onwards, maybe even as soon as 2.5.
The sdk meanwhile must work with a wide range of versions of the server, so it can only offer officially available features in its public API.


#3

Bummer! I found it a great feature. Thanks anyway.


#4

Note that if you create the “all” view, you don’t have to emit anything else than the Id
emit(doc.id, null)


#5

Hey @s1awek, you may have found it a “great feature” since you were using it lightly. Part of the reason it was unsupported and undocumented is that it had some known downsides in implementation. The real answer that uses regular approaches is the one @simonbasle mentions. Just create that view and you’ll have exactly what you need. Plus, it’ll perform well and be reliable. It takes one extra step, but a very short one.


#6

I don’t know about implementation details and drawbacks so I won’t argue about that. On the contrary, as far as I know reading documents directly is strongly consistent vs eventually consistent views which furthermore need to be indexed every time unit. Plus, one extra tiny step.
Anyway, with this new API I was able to easily create buckets and corresponding “all doc” views following @simonbasle suggestion.