@mikro-orm/knex 6.0.3-dev.3 → 6.0.3-dev.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.0.3-dev.3",
3
+ "version": "6.0.3-dev.4",
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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.0.2"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.0.3-dev.3"
69
+ "@mikro-orm/core": "6.0.3-dev.4"
70
70
  }
71
71
  }
@@ -402,14 +402,18 @@ class QueryBuilderHelper {
402
402
  qb[m](this.mapper(key, type, cond[key], null), op, cond[key]);
403
403
  }
404
404
  processObjectSubCondition(cond, key, qb, method, m, type) {
405
- // grouped condition for one field
406
405
  let value = cond[key];
407
406
  const size = core_1.Utils.getObjectKeysSize(value);
408
407
  if (core_1.Utils.isPlainObject(value) && size === 0) {
409
408
  return;
410
409
  }
410
+ // grouped condition for one field, e.g. `{ age: { $gte: 10, $lt: 50 } }`
411
411
  if (size > 1) {
412
- const subCondition = Object.entries(value).map(([subKey, subValue]) => ({ [key]: { [subKey]: subValue } }));
412
+ const rawField = core_1.RawQueryFragment.getKnownFragment(key);
413
+ const subCondition = Object.entries(value).map(([subKey, subValue]) => {
414
+ key = rawField?.clone().toString() ?? key;
415
+ return ({ [key]: { [subKey]: subValue } });
416
+ });
413
417
  return subCondition.forEach(sub => this.appendQueryCondition(type, sub, qb, '$and', method));
414
418
  }
415
419
  if (value instanceof RegExp) {