@mikro-orm/mongodb 7.0.0-dev.120 → 7.0.0-dev.121
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 +1 -1
- package/MongoDriver.js +13 -8
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
package/MongoConnection.js
CHANGED
|
@@ -379,7 +379,7 @@ export class MongoConnection extends Connection {
|
|
|
379
379
|
return meta ? meta.collection : Utils.className(entityName);
|
|
380
380
|
}
|
|
381
381
|
logObject(o) {
|
|
382
|
-
if (o
|
|
382
|
+
if (o?.session) {
|
|
383
383
|
o = { ...o, session: `[ClientSession]` };
|
|
384
384
|
}
|
|
385
385
|
return inspect(o, { depth: 5, compact: true, breakLength: 300 });
|
package/MongoDriver.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectId } from 'mongodb';
|
|
2
|
-
import { DatabaseDriver, EntityManagerType,
|
|
2
|
+
import { DatabaseDriver, EntityManagerType, ReferenceKind, Utils, } from '@mikro-orm/core';
|
|
3
3
|
import { MongoConnection } from './MongoConnection.js';
|
|
4
4
|
import { MongoPlatform } from './MongoPlatform.js';
|
|
5
5
|
import { MongoEntityManager } from './MongoEntityManager.js';
|
|
@@ -201,7 +201,13 @@ export class MongoDriver extends DatabaseDriver {
|
|
|
201
201
|
getPlatform() {
|
|
202
202
|
return this.platform;
|
|
203
203
|
}
|
|
204
|
-
renameFields(entityName, data, dotPaths = false, object) {
|
|
204
|
+
renameFields(entityName, data, dotPaths = false, object, root = true) {
|
|
205
|
+
if (data == null && root) {
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
208
|
+
if (typeof data !== 'object' || data === null) {
|
|
209
|
+
return data;
|
|
210
|
+
}
|
|
205
211
|
// copy to new variable to prevent changing the T type or doing as unknown casts
|
|
206
212
|
const copiedData = Object.assign({}, data); // copy first
|
|
207
213
|
const meta = this.metadata.find(entityName);
|
|
@@ -237,13 +243,12 @@ export class MongoDriver extends DatabaseDriver {
|
|
|
237
243
|
throw new Error('Full text search is only supported on the top level of the query object.');
|
|
238
244
|
}
|
|
239
245
|
Utils.keys(copiedData).forEach(k => {
|
|
240
|
-
if (k
|
|
241
|
-
/* v8 ignore next */
|
|
246
|
+
if (Utils.isOperator(k)) {
|
|
242
247
|
if (Array.isArray(copiedData[k])) {
|
|
243
|
-
copiedData[k] = copiedData[k].map(v => this.renameFields(entityName, v));
|
|
248
|
+
copiedData[k] = copiedData[k].map(v => this.renameFields(entityName, v, dotPaths, object, false));
|
|
244
249
|
}
|
|
245
250
|
else {
|
|
246
|
-
copiedData[k] = this.renameFields(entityName, copiedData[k]);
|
|
251
|
+
copiedData[k] = this.renameFields(entityName, copiedData[k], dotPaths, object, false);
|
|
247
252
|
}
|
|
248
253
|
return;
|
|
249
254
|
}
|
|
@@ -258,10 +263,10 @@ export class MongoDriver extends DatabaseDriver {
|
|
|
258
263
|
return;
|
|
259
264
|
}
|
|
260
265
|
if (prop.array && Array.isArray(copiedData[prop.name])) {
|
|
261
|
-
copiedData[prop.name] = copiedData[prop.name].map((item) => this.renameFields(prop.targetMeta.class, item, dotPaths, true));
|
|
266
|
+
copiedData[prop.name] = copiedData[prop.name].map((item) => this.renameFields(prop.targetMeta.class, item, dotPaths, true, false));
|
|
262
267
|
}
|
|
263
268
|
else {
|
|
264
|
-
copiedData[prop.name] = this.renameFields(prop.targetMeta.class, copiedData[prop.name], dotPaths, prop.object || object);
|
|
269
|
+
copiedData[prop.name] = this.renameFields(prop.targetMeta.class, copiedData[prop.name], dotPaths, prop.object || object, false);
|
|
265
270
|
}
|
|
266
271
|
}
|
|
267
272
|
else {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mongodb",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.121",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"@mikro-orm/core": "^6.6.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
59
|
+
"@mikro-orm/core": "7.0.0-dev.121"
|
|
60
60
|
}
|
|
61
61
|
}
|