How to get schema from a bucket

Hi.

i want to get schema from a bucket, and also how to get all fields from a bucket using .net sdk

Hi @balakrishnanvaluesol,

One of the features of Couchbase and most other document databases is that there isn’t an enforced schema per se, other than the self-described schema of each JSON document.

That being said, you might want to look into INFER. It will sample documents, group them together based on fields they have in common, and generally give you an idea of the shape of the data.

Note that this is an Enterprise feature only.

In the couchbase beer-sample, in open the bucket in .net, how can i retrieving the bucket tables
like [couchbase.beer_Sample, couchbase.beer_Sample.beer, couchbase.beer_Sample.brewery], and also how can i get this table columns using couchbase SDK.

Hi @balakrishnanvaluesol,

There are no “tables” or “columns” in Couchbase. Each document is a self-contained JSON document that doesn’t have to share any characteristics with other documents.

If you use INFER, then Couchbase will sample the documents to see what they have in common.

If you INFER `beer-sample`, for instance, it will tell you that there are two main “flavors” of documents, “brewery” and “beer”. If you look at “properties” of beer, it will tell you what properties that beer documents have in commons (for instance, “abv”, “style”, “category”, etc).

1 Like