@mikro-orm/mongodb 7.2.13-dev.7 → 7.2.13-dev.8
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/MongoConnection.js +0 -9
- package/MongoDriver.js +6 -2
- package/package.json +2 -2
package/MongoConnection.js
CHANGED
|
@@ -392,17 +392,11 @@ export class MongoConnection extends Connection {
|
|
|
392
392
|
}
|
|
393
393
|
});
|
|
394
394
|
const $unset = {};
|
|
395
|
-
const $inc = {};
|
|
396
395
|
for (const k of Utils.keys(row)) {
|
|
397
396
|
const item = row[k];
|
|
398
397
|
if (typeof item === 'undefined') {
|
|
399
398
|
$unset[k] = '';
|
|
400
399
|
delete row[k];
|
|
401
|
-
continue;
|
|
402
|
-
}
|
|
403
|
-
if (Utils.isPlainObject(item) && '$inc' in item) {
|
|
404
|
-
$inc[k] = item.$inc;
|
|
405
|
-
delete row[k];
|
|
406
400
|
}
|
|
407
401
|
}
|
|
408
402
|
if (upsertOptions) {
|
|
@@ -431,9 +425,6 @@ export class MongoConnection extends Connection {
|
|
|
431
425
|
if (Utils.hasObjectKeys($unset)) {
|
|
432
426
|
doc.$unset = $unset;
|
|
433
427
|
}
|
|
434
|
-
if (Utils.hasObjectKeys($inc)) {
|
|
435
|
-
doc.$inc = $inc;
|
|
436
|
-
}
|
|
437
428
|
if (!Utils.hasObjectKeys(doc.$set)) {
|
|
438
429
|
delete doc.$set;
|
|
439
430
|
}
|
package/MongoDriver.js
CHANGED
|
@@ -585,8 +585,12 @@ export class MongoDriver extends DatabaseDriver {
|
|
|
585
585
|
if (versionProperty.runtimeType === 'Date') {
|
|
586
586
|
data[versionProperty.name] ??= new Date();
|
|
587
587
|
}
|
|
588
|
-
else {
|
|
589
|
-
data[versionProperty.name] ??=
|
|
588
|
+
else if (!update) {
|
|
589
|
+
data[versionProperty.name] ??= 1;
|
|
590
|
+
}
|
|
591
|
+
else if (data[versionProperty.name] == null) {
|
|
592
|
+
delete data[versionProperty.name];
|
|
593
|
+
data.$inc = { ...data.$inc, [versionProperty.fieldNames[0]]: 1 };
|
|
590
594
|
}
|
|
591
595
|
}
|
|
592
596
|
/** @inheritDoc */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mongodb",
|
|
3
|
-
"version": "7.2.13-dev.
|
|
3
|
+
"version": "7.2.13-dev.8",
|
|
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.12"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.2.13-dev.
|
|
56
|
+
"@mikro-orm/core": "7.2.13-dev.8"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|