@mikro-orm/mongodb 6.3.9-dev.3 → 6.3.9-dev.5

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.
Files changed (2) hide show
  1. package/MongoDriver.js +7 -7
  2. package/package.json +2 -2
package/MongoDriver.js CHANGED
@@ -38,14 +38,14 @@ class MongoDriver extends core_1.DatabaseDriver {
38
38
  const meta = this.metadata.find(entityName);
39
39
  const { orderBy: newOrderBy, where: newWhere } = this.processCursorOptions(meta, options, options.orderBy);
40
40
  const newWhereConverted = this.renameFields(entityName, newWhere, true);
41
- const orderBy = core_1.Utils.asArray(newOrderBy).map(order => this.renameFields(entityName, order));
41
+ const orderBy = core_1.Utils.asArray(newOrderBy).map(order => this.renameFields(entityName, order, true));
42
42
  const res = await this.rethrow(this.getConnection('read').find(entityName, andWhere(where, newWhereConverted), orderBy, options.limit, options.offset, fields, options.ctx, options.logging));
43
43
  if (isCursorPagination && !first && !!last) {
44
44
  res.reverse();
45
45
  }
46
46
  return res.map(r => this.mapResult(r, this.metadata.find(entityName)));
47
47
  }
48
- const orderBy = core_1.Utils.asArray(options.orderBy).map(orderBy => this.renameFields(entityName, orderBy, false));
48
+ const orderBy = core_1.Utils.asArray(options.orderBy).map(orderBy => this.renameFields(entityName, orderBy, true));
49
49
  const res = await this.rethrow(this.getConnection('read').find(entityName, where, orderBy, options.limit, options.offset, fields, options.ctx));
50
50
  return res.map(r => this.mapResult(r, this.metadata.find(entityName)));
51
51
  }
@@ -60,7 +60,7 @@ class MongoDriver extends core_1.DatabaseDriver {
60
60
  }
61
61
  const fields = this.buildFields(entityName, options.populate || [], options.fields, options.exclude);
62
62
  where = this.renameFields(entityName, where, true);
63
- const orderBy = core_1.Utils.asArray(options.orderBy).map(orderBy => this.renameFields(entityName, orderBy, false));
63
+ const orderBy = core_1.Utils.asArray(options.orderBy).map(orderBy => this.renameFields(entityName, orderBy, true));
64
64
  const res = await this.rethrow(this.getConnection('read').find(entityName, where, orderBy, 1, undefined, fields, options.ctx, options.logging));
65
65
  return this.mapResult(res[0], this.metadata.find(entityName));
66
66
  }
@@ -163,7 +163,7 @@ class MongoDriver extends core_1.DatabaseDriver {
163
163
  getPlatform() {
164
164
  return this.platform;
165
165
  }
166
- renameFields(entityName, data, where = false, object) {
166
+ renameFields(entityName, data, dotPaths = false, object) {
167
167
  // copy to new variable to prevent changing the T type or doing as unknown casts
168
168
  const copiedData = Object.assign({}, data); // copy first
169
169
  const meta = this.metadata.find(entityName);
@@ -171,7 +171,7 @@ class MongoDriver extends core_1.DatabaseDriver {
171
171
  core_1.Utils.renameKey(copiedData, meta.serializedPrimaryKey, meta.primaryKeys[0]);
172
172
  }
173
173
  if (meta && !meta.embeddable) {
174
- this.inlineEmbeddables(meta, copiedData, where);
174
+ this.inlineEmbeddables(meta, copiedData, dotPaths);
175
175
  }
176
176
  // If we had a query with $fulltext and some filter we end up with $and with $fulltext in it.
177
177
  // We will try to move $fulltext to top level.
@@ -220,10 +220,10 @@ class MongoDriver extends core_1.DatabaseDriver {
220
220
  return;
221
221
  }
222
222
  if (prop.array && Array.isArray(copiedData[prop.name])) {
223
- copiedData[prop.name] = copiedData[prop.name].map((item) => this.renameFields(prop.type, item, where, true));
223
+ copiedData[prop.name] = copiedData[prop.name].map((item) => this.renameFields(prop.type, item, dotPaths, true));
224
224
  }
225
225
  else {
226
- copiedData[prop.name] = this.renameFields(prop.type, copiedData[prop.name], where, prop.object || object);
226
+ copiedData[prop.name] = this.renameFields(prop.type, copiedData[prop.name], dotPaths, prop.object || object);
227
227
  }
228
228
  }
229
229
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mongodb",
3
- "version": "6.3.9-dev.3",
3
+ "version": "6.3.9-dev.5",
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",
@@ -65,6 +65,6 @@
65
65
  "@mikro-orm/core": "^6.3.8"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mikro-orm/core": "6.3.9-dev.3"
68
+ "@mikro-orm/core": "6.3.9-dev.5"
69
69
  }
70
70
  }