@mikro-orm/core
Advanced tools
@@ -448,3 +448,6 @@ import { QueryHelper } from '../utils/QueryHelper.js'; | ||
| } | ||
| if ([ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) && items.length !== children.length) { | ||
| // a missing target row means an orphaned reference, unless the query was narrowed by a populate condition | ||
| if ([ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) && | ||
| items.length !== children.length && | ||
| Utils.isEmpty(options.where)) { | ||
| const nullVal = this.#em.config.get('forceUndefined') ? undefined : null; | ||
@@ -671,3 +674,5 @@ const itemsMap = new Set(); | ||
| }); | ||
| if (child.length > 0) { | ||
| // partial extraction from `$or` is unsound for to-one relations — the parent may have matched via a dropped branch | ||
| const toOne = [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind); | ||
| if (child.length > 0 && (op === '$and' || !toOne || child.length === where[op].length)) { | ||
| subCond[op] = child; | ||
@@ -674,0 +679,0 @@ } |
+1
-1
| { | ||
| "name": "@mikro-orm/core", | ||
| "version": "7.1.13-dev.5", | ||
| "version": "7.1.13-dev.6", | ||
| "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,0 +5,0 @@ "keywords": [ |
+1
-1
@@ -156,3 +156,3 @@ import { clone } from './clone.js'; | ||
| static PK_SEPARATOR = '~~~'; | ||
| static #ORM_VERSION = '7.1.13-dev.5'; | ||
| static #ORM_VERSION = '7.1.13-dev.6'; | ||
| /** | ||
@@ -159,0 +159,0 @@ * Checks if the argument is instance of `Object`. Returns false for arrays. |
1586792
0.03%33831
0.01%