nkat
nkat

Reputation: 129

Get all documents from Couchbase bucket

I am writing Couchbase DAO using Java API. I store all documents for one entity in particular bucket. I wonder what is the best way to get all documents from this bucket? Thanks in advance!

Upvotes: 4

Views: 6321

Answers (1)

Matthew Groves
Matthew Groves

Reputation: 26096

First: do you plan to store each entity type in their own buckets? That will probably not work in the long run, unless you plan to only ever have no more than 10 total entities. Buckets are not made to organize data like that: they are meant to store a variety of different types of data.

Second: do you really want to get all data from a bucket? That seems like a very uncommon use case. It's almost like asking "how do I query all data from all tables in a relational database"

That being said, I could imagine a very specialized situation where you'd want to do this. So, you could:

Both of these things can be done with the Java SDK.

Upvotes: 4

Related Questions