Just wondering, but why doesn’t the couchbase node SDK bucket class expose a function to get the bucket’s name?
By source diving, I can tell that this is stored in an attribute called _name, but of course the naming of that attribute suggests that the SDK wants outsiders to stay out.
A simple function getName() would seem to be really helpful, since it would allow people to pass around buckets without knowing their name, and then get the name to do things like build n1ql queries on the basis of those buckets.
Another odd thing I noticed about the Couchbase Node SDK is the query() method on the bucket. I would have expected to see this on the Cluster object, since of course n1ql queries can run across buckets. When I use this method, is there anything actually bucket-specific to be aware of?
@brett19 can answer your first question (since he’s the one in charge of the node SDK), but the second question is more generic.
And the answer is that cluster-level queries, or rather cross-bucket query support, is something on the roadmap. For now, authentication support is strongly tied to the
Bucket, so queries targeting such a password-protected bucket must be executed by a
Bucket instance corresponding to that particular bucket.
Cross-bucket queries can thus only target 1 password-protected bucket (the one corresponding to the
Bucket from where you execute the
query()), but targeting n additional non-protected buckets should work.
It’s also an inheritage kind of thing, because SDKs have been historically built to offer most of the data interaction API on the
We are working on designing a mean to provide multiple credentials at the cluster level, which would enable any combination of cross bucket queries in the future.
Just as an update to this post, we integrated and have now released the ability to perform cluster-level queries (N1QL / CBFT). See the commit here which landed in v2.1.7: https://github.com/couchbase/couchnode/commit/20c9f833ae325e44013c1d69290ace6d51427e15
Excellent. Going to upgrade to 2.1.7