@mikro-orm/mongodb 7.2.2-dev.24 → 7.2.2-dev.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.
Files changed (2) hide show
  1. package/MongoDriver.js +6 -0
  2. package/package.json +2 -2
package/MongoDriver.js CHANGED
@@ -428,6 +428,12 @@ export class MongoDriver extends DatabaseDriver {
428
428
  // the FK field is named after the property, e.g. `{ likeable: { $in: ids } }` when loading the inverse side
429
429
  copiedData[k] = this.convertObjectIds(value);
430
430
  }
431
+ else if (Utils.isPlainObject(value) &&
432
+ Utils.getObjectKeysSize(value) === 1 &&
433
+ prop.targetMeta.primaryKeys[0] in value) {
434
+ // PK-only condition, e.g. `{ likeable: { _id: { $in: ids } } }`, compares the FK field
435
+ copiedData[prop.fieldNames[1]] = this.convertObjectIds(value[prop.targetMeta.primaryKeys[0]]);
436
+ }
431
437
  else {
432
438
  throw new Error(`Unsupported condition on polymorphic relation ${meta.className}.${prop.name}, use an entity reference or \`null\` instead.`);
433
439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mongodb",
3
- "version": "7.2.2-dev.24",
3
+ "version": "7.2.2-dev.25",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.2.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.2-dev.24"
56
+ "@mikro-orm/core": "7.2.2-dev.25"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"