spice-couchbase 2.0.36 → 2.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -476,6 +476,7 @@ module.exports = class Database {
476
476
  var order_by = arguments.length > 5 ? arguments[5] : undefined;
477
477
  var do_count = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : "false";
478
478
  var query_scope = arguments.length > 7 ? arguments[7] : undefined;
479
+ var join = arguments.length > 8 ? arguments[8] : undefined;
479
480
  return _asyncToGenerator(function* () {
480
481
  var is_legacy = _this15.scope_name !== "_default" && _this15.collection_name !== "_default";
481
482
  var bucket = "`".concat(_this15.use_bucket_name ? _this15.bucket : _this15.collection_name, "`");
@@ -493,7 +494,7 @@ module.exports = class Database {
493
494
  columns = "".concat(columns).concat(fix);
494
495
  }
495
496
 
496
- var front_query = "SELECT ".concat(columns, " FROM ").concat(bucket);
497
+ var front_query = "SELECT ".concat(columns, " FROM ").concat(bucket, " ").concat(join);
497
498
  var conditions = [];
498
499
 
499
500
  if (_this15.use_bucket_name) {
@@ -506,7 +507,8 @@ module.exports = class Database {
506
507
 
507
508
  var where_clause = conditions.length ? " WHERE " : "";
508
509
  query = front_query + where_clause + conditions.join(" AND ");
509
- var count_query = "SELECT count(meta().id) as count FROM ".concat(bucket).concat(where_clause);
510
+ var count_query = "SELECT count(meta(".concat(bucket, ").id) as count FROM ").concat(bucket, " ").concat(join, " ").concat(where_clause); //console.log("Cound Query::", count_query);
511
+
510
512
  var order_by_clause = order_by ? " ORDER BY ".concat(order_by) : "";
511
513
  var limit_clause = limit > 0 ? " LIMIT ".concat(limit) : "";
512
514
  var offset_clause = offset > 0 ? " OFFSET ".concat(offset) : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-couchbase",
3
- "version": "2.0.36",
3
+ "version": "2.0.37",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -417,7 +417,8 @@ module.exports = class Database {
417
417
  offset = 0,
418
418
  order_by,
419
419
  do_count = "false",
420
- query_scope
420
+ query_scope,
421
+ join
421
422
  ) {
422
423
  const is_legacy =
423
424
  this.scope_name !== "_default" && this.collection_name !== "_default";
@@ -439,7 +440,7 @@ module.exports = class Database {
439
440
  } else if (!containsIdWithSpace(columns)) {
440
441
  columns = `${columns}${fix}`;
441
442
  }
442
- const front_query = `SELECT ${columns} FROM ${bucket}`;
443
+ const front_query = `SELECT ${columns} FROM ${bucket} ${join}`;
443
444
  const conditions = [];
444
445
 
445
446
  if (this.use_bucket_name) {
@@ -452,7 +453,8 @@ module.exports = class Database {
452
453
  const where_clause = conditions.length ? " WHERE " : "";
453
454
  query = front_query + where_clause + conditions.join(" AND ");
454
455
 
455
- const count_query = `SELECT count(meta().id) as count FROM ${bucket}${where_clause}`;
456
+ const count_query = `SELECT count(meta(${bucket}).id) as count FROM ${bucket} ${join} ${where_clause}`;
457
+ //console.log("Cound Query::", count_query);
456
458
  const order_by_clause = order_by ? ` ORDER BY ${order_by}` : "";
457
459
  const limit_clause = limit > 0 ? ` LIMIT ${limit}` : "";
458
460
  const offset_clause = offset > 0 ? ` OFFSET ${offset}` : "";