Reuse DefaultCollection

I am using .net sdk 3.03 and Server 6.5
Do I need to call
var collection = bucket.DefaultCollection();
for each KV or Query operation or I can initialize it once along with a bucket like
static ICouchbaseCollection AllDocuments = bucket.DefaultCollection();
and reuse AllDocuments collection for a life-time of the bucket object ?
Thanks

@skaryshev -

You can reuse the collection over and over again as long as ICluster and IBucket are within scope. If either are disposed/closed or reclaimed via GC, then the collection will also no longer function properly.

-Jeff

1 Like