@atscript/db-mongo 0.1.41 → 0.1.43

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/dist/index.cjs CHANGED
@@ -1309,7 +1309,8 @@ var MongoAdapter = class MongoAdapter extends _atscript_db.BaseDbAdapter {
1309
1309
  removePrimaryKeys: meta.originalMetaIdFields.filter((f) => f !== "_id"),
1310
1310
  addUniqueFields: uniqueFields.length > 0 ? uniqueFields : void 0
1311
1311
  };
1312
- uniqueFields.push("_id");
1312
+ const effectiveUnique = uniqueFields.filter((f) => meta.primaryKeys.length <= 1 || !meta.primaryKeys.includes(f));
1313
+ effectiveUnique.push("_id");
1313
1314
  return {
1314
1315
  injectFields: [{
1315
1316
  path: "_id",
@@ -1323,7 +1324,7 @@ var MongoAdapter = class MongoAdapter extends _atscript_db.BaseDbAdapter {
1323
1324
  metadata: /* @__PURE__ */ new Map()
1324
1325
  }
1325
1326
  }],
1326
- addUniqueFields: uniqueFields
1327
+ addUniqueFields: effectiveUnique
1327
1328
  };
1328
1329
  }
1329
1330
  onAfterFlatten() {
package/dist/index.mjs CHANGED
@@ -1308,7 +1308,8 @@ var MongoAdapter = class MongoAdapter extends BaseDbAdapter {
1308
1308
  removePrimaryKeys: meta.originalMetaIdFields.filter((f) => f !== "_id"),
1309
1309
  addUniqueFields: uniqueFields.length > 0 ? uniqueFields : void 0
1310
1310
  };
1311
- uniqueFields.push("_id");
1311
+ const effectiveUnique = uniqueFields.filter((f) => meta.primaryKeys.length <= 1 || !meta.primaryKeys.includes(f));
1312
+ effectiveUnique.push("_id");
1312
1313
  return {
1313
1314
  injectFields: [{
1314
1315
  path: "_id",
@@ -1322,7 +1323,7 @@ var MongoAdapter = class MongoAdapter extends BaseDbAdapter {
1322
1323
  metadata: /* @__PURE__ */ new Map()
1323
1324
  }
1324
1325
  }],
1325
- addUniqueFields: uniqueFields
1326
+ addUniqueFields: effectiveUnique
1326
1327
  };
1327
1328
  }
1328
1329
  onAfterFlatten() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db-mongo",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "Mongodb plugin for atscript.",
5
5
  "keywords": [
6
6
  "atscript",
@@ -51,16 +51,16 @@
51
51
  "access": "public"
52
52
  },
53
53
  "devDependencies": {
54
- "@atscript/core": "^0.1.39",
55
- "@atscript/typescript": "^0.1.39",
54
+ "@atscript/core": "^0.1.41",
55
+ "@atscript/typescript": "^0.1.41",
56
56
  "mongodb": "^6.17.0",
57
- "unplugin-atscript": "^0.1.39"
57
+ "unplugin-atscript": "^0.1.41"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atscript/core": "^0.1.39",
61
- "@atscript/typescript": "^0.1.39",
60
+ "@atscript/core": "^0.1.41",
61
+ "@atscript/typescript": "^0.1.41",
62
62
  "mongodb": "^6.17.0",
63
- "@atscript/db": "^0.1.41"
63
+ "@atscript/db": "^0.1.43"
64
64
  },
65
65
  "scripts": {
66
66
  "postinstall": "asc -f dts",