Select from opened bucket

To run a n1ql query in nodejs we do

query = N1qlQuery.fromString('SELECT name, email FROM users WHERE name=$1');
bucket.query(query, ['Monty Python'], function(err, rows) {
  // ...
});

As bucket is a opened bucked

bucket = cluster.openBucket('users');

How can we tell N1qlQuery that query to the current opened bucket that means :

bucket1 = cluster.openBucket('users1');
bucket2 = cluster.openBucket('users2');

query = N1qlQuery.fromString('SELECT name, email FROM **CURRENT_OPENED_BUCKET** WHERE name=$1');

// Query on users1 bucket
bucket1.query(query, ['Monty Python'], function(err, rows) {
  // ...
});

// Query on users2 bucket
bucket2.query(query, ['Monty Python'], function(err, rows) {
  // ...
});

Is there any solution?

Hey @socketman2016,

It is currently possible to fetch the bucket name through the undocumented (and not-exactly-supported) _name property on the bucket objects. I have however opened an issue to get a proper property implemented which exposes this: https://issues.couchbase.com/browse/JSCBC-520 .

Cheers, Brett