@frogfish/k2db 3.0.4 → 3.0.6
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/db.js +7 -3
- package/package.json +1 -1
package/db.js
CHANGED
|
@@ -1182,8 +1182,10 @@ export class K2DB {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
else if (lu.localField && lu.foreignField) {
|
|
1184
1184
|
// Convert simple lookup to pipeline lookup so we can enforce owner scope (and deleted) in foreign coll.
|
|
1185
|
-
|
|
1186
|
-
|
|
1185
|
+
// NOTE: MongoDB aggregation user variables must start with a letter.
|
|
1186
|
+
// Avoid leading underscores (e.g. "__lk") which fail to parse on MongoDB.
|
|
1187
|
+
const localVar = "k2lk";
|
|
1188
|
+
const ownerVar = "k2own";
|
|
1187
1189
|
lu.let = { [localVar]: `$${lu.localField}`, [ownerVar]: normalizedScope };
|
|
1188
1190
|
lu.pipeline = [
|
|
1189
1191
|
{
|
|
@@ -1276,7 +1278,9 @@ export class K2DB {
|
|
|
1276
1278
|
}
|
|
1277
1279
|
else if (lu.localField && lu.foreignField) {
|
|
1278
1280
|
// Convert simple lookup to pipeline lookup to filter _deleted
|
|
1279
|
-
|
|
1281
|
+
// NOTE: MongoDB aggregation user variables must start with a letter.
|
|
1282
|
+
// Avoid leading underscores (e.g. "__lk") which fail to parse on MongoDB.
|
|
1283
|
+
const localVar = "k2lk";
|
|
1280
1284
|
lu.let = { [localVar]: `$${lu.localField}` };
|
|
1281
1285
|
lu.pipeline = [
|
|
1282
1286
|
{
|