spice-couchbase 2.0.23 → 2.0.25
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 +5 -1
- package/package.json +1 -1
- package/src/index.js +5 -1
package/build/index.js
CHANGED
|
@@ -446,6 +446,10 @@ module.exports = class Database {
|
|
|
446
446
|
var is_legacy = _this15.scope_name !== "_default" && _this15.collection_name !== "_default";
|
|
447
447
|
var bucket = "`".concat(_this15.use_bucket_name ? _this15.bucket : _this15.collection_name, "`");
|
|
448
448
|
|
|
449
|
+
function containsIdWithSpace(str) {
|
|
450
|
+
return /\bid/i.test(str); // \b for word boundary, 'i' flag for case-insensitive matching
|
|
451
|
+
}
|
|
452
|
+
|
|
449
453
|
try {
|
|
450
454
|
var fix = ", META(".concat(bucket, ").id AS id");
|
|
451
455
|
|
|
@@ -457,7 +461,7 @@ module.exports = class Database {
|
|
|
457
461
|
columns = "";
|
|
458
462
|
}
|
|
459
463
|
|
|
460
|
-
var front_query = "SELECT ".concat(columns, " ").concat(fix, " FROM ").concat(bucket);
|
|
464
|
+
var front_query = "SELECT ".concat(columns, " ").concat(containsIdWithSpace(columns) ? "" : fix, " FROM ").concat(bucket);
|
|
461
465
|
var conditions = [];
|
|
462
466
|
|
|
463
467
|
if (_this15.use_bucket_name) {
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -416,6 +416,10 @@ module.exports = class Database {
|
|
|
416
416
|
this.use_bucket_name ? this.bucket : this.collection_name
|
|
417
417
|
}\``;
|
|
418
418
|
|
|
419
|
+
function containsIdWithSpace(str) {
|
|
420
|
+
return /\bid/i.test(str); // \b for word boundary, 'i' flag for case-insensitive matching
|
|
421
|
+
}
|
|
422
|
+
|
|
419
423
|
try {
|
|
420
424
|
const fix = `, META(${bucket}).id AS id`;
|
|
421
425
|
|
|
@@ -427,7 +431,7 @@ module.exports = class Database {
|
|
|
427
431
|
columns = "";
|
|
428
432
|
}
|
|
429
433
|
|
|
430
|
-
const front_query = `SELECT ${columns} ${fix} FROM ${bucket}`;
|
|
434
|
+
const front_query = `SELECT ${columns} ${containsIdWithSpace(columns) ? "" : fix} FROM ${bucket}`;
|
|
431
435
|
const conditions = [];
|
|
432
436
|
|
|
433
437
|
if (this.use_bucket_name) {
|