@mikro-orm/mongodb 6.6.20-dev.0 → 6.6.20-dev.2

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.
@@ -1,6 +1,10 @@
1
1
  import { MongoClient, type ClientSession, type Collection, type Db, type MongoClientOptions, type TransactionOptions } from 'mongodb';
2
2
  import { Connection, type AnyEntity, type Configuration, type ConnectionConfig, type ConnectionOptions, type ConnectionType, type EntityData, type EntityName, type FilterQuery, type IsolationLevel, type QueryOrderMap, type QueryResult, type Transaction, type TransactionEventBroadcaster, type UpsertOptions, type UpsertManyOptions, type LoggingOptions } from '@mikro-orm/core';
3
3
  export declare class MongoConnection extends Connection {
4
+ /** @internal marks a version property to be incremented, other values with an `$inc` key are stored as they are */
5
+ static readonly VERSION_INCREMENT: Readonly<{
6
+ $inc: 1;
7
+ }>;
4
8
  protected client: MongoClient;
5
9
  protected db: Db;
6
10
  constructor(config: Configuration, options?: ConnectionOptions, type?: ConnectionType);
@@ -6,6 +6,8 @@ const bson_1 = require("bson");
6
6
  const node_util_1 = require("node:util");
7
7
  const core_1 = require("@mikro-orm/core");
8
8
  class MongoConnection extends core_1.Connection {
9
+ /** @internal marks a version property to be incremented, other values with an `$inc` key are stored as they are */
10
+ static VERSION_INCREMENT = Object.freeze({ $inc: 1 });
9
11
  client;
10
12
  db;
11
13
  constructor(config, options, type = 'write') {
@@ -302,7 +304,7 @@ class MongoConnection extends core_1.Connection {
302
304
  delete row[k];
303
305
  continue;
304
306
  }
305
- if (core_1.Utils.isPlainObject(item) && '$inc' in item) {
307
+ if (item === MongoConnection.VERSION_INCREMENT) {
306
308
  $inc[k] = item.$inc;
307
309
  delete row[k];
308
310
  }
package/MongoDriver.js CHANGED
@@ -332,7 +332,7 @@ class MongoDriver extends core_1.DatabaseDriver {
332
332
  data[versionProperty.name] ??= new Date();
333
333
  }
334
334
  else {
335
- data[versionProperty.name] ??= update ? { $inc: 1 } : 1;
335
+ data[versionProperty.name] ??= update ? MongoConnection_1.MongoConnection.VERSION_INCREMENT : 1;
336
336
  }
337
337
  }
338
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mongodb",
3
- "version": "6.6.20-dev.0",
3
+ "version": "6.6.20-dev.2",
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.6.19"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mikro-orm/core": "6.6.20-dev.0"
68
+ "@mikro-orm/core": "6.6.20-dev.2"
69
69
  }
70
70
  }