@mikro-orm/mongodb 7.2.4-dev.8 → 7.2.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/MongoDriver.js +6 -0
- package/package.json +3 -3
package/MongoDriver.js
CHANGED
|
@@ -233,6 +233,12 @@ export class MongoDriver extends DatabaseDriver {
|
|
|
233
233
|
if (Utils.isPrimaryKey(where)) {
|
|
234
234
|
where = this.buildFilterById(entityName, where);
|
|
235
235
|
}
|
|
236
|
+
// an empty filter would match (and overwrite) every document, so insert instead
|
|
237
|
+
if (options.upsert && Utils.isEmpty(where)) {
|
|
238
|
+
const res = await this.nativeInsert(entityName, data, options);
|
|
239
|
+
res.row = { _id: res.insertId };
|
|
240
|
+
return res;
|
|
241
|
+
}
|
|
236
242
|
this.handleVersionProperty(entityName, data, true);
|
|
237
243
|
data = this.renameFields(entityName, data);
|
|
238
244
|
where = this.renameFields(entityName, where, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mongodb",
|
|
3
|
-
"version": "7.2.4
|
|
3
|
+
"version": "7.2.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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"mongodb": "7.7.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@mikro-orm/core": "^7.2.
|
|
53
|
+
"@mikro-orm/core": "^7.2.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.2.4
|
|
56
|
+
"@mikro-orm/core": "7.2.4"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|