@mikro-orm/mongodb 7.1.16-dev.10 → 7.1.16-dev.12

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.
@@ -18,6 +18,8 @@ export declare class MongoConnection extends Connection {
18
18
  error?: Error;
19
19
  }>;
20
20
  getClient(): MongoClient;
21
+ /** Returns the `MongoClient` backing this connection, the async counterpart of `getClient()`. */
22
+ getNativeClient(): Promise<MongoClient>;
21
23
  getCollection<T extends object>(name: EntityName<T> | string): Collection<T>;
22
24
  createCollection<T extends object>(name: EntityName<T>): Promise<Collection<T>>;
23
25
  listCollections(): Promise<string[]>;
@@ -76,6 +76,11 @@ export class MongoConnection extends Connection {
76
76
  }
77
77
  return this.#client;
78
78
  }
79
+ /** Returns the `MongoClient` backing this connection, the async counterpart of `getClient()`. */
80
+ async getNativeClient() {
81
+ await this.ensureConnection();
82
+ return this.getClient();
83
+ }
79
84
  getCollection(name) {
80
85
  return this.getDb().collection(this.getCollectionName(name));
81
86
  }
@@ -5,6 +5,8 @@ import { MongoSchemaGenerator } from './MongoSchemaGenerator.js';
5
5
  /** Platform implementation for MongoDB. */
6
6
  export declare class MongoPlatform extends Platform {
7
7
  protected readonly exceptionConverter: MongoExceptionConverter;
8
+ /** Mongo always sorts null and missing values lowest, and cannot be asked for anything else. */
9
+ sortsNullsLowest(): boolean;
8
10
  setConfig(config: Configuration): void;
9
11
  getNamingStrategy(): {
10
12
  new (): NamingStrategy;
@@ -20,6 +22,7 @@ export declare class MongoPlatform extends Platform {
20
22
  usesImplicitTransactions(): boolean;
21
23
  convertsJsonAutomatically(): boolean;
22
24
  preservesDatesInsideJson(): boolean;
25
+ supportsNullsOrdering(): boolean;
23
26
  convertJsonToDatabaseValue(value: unknown): unknown;
24
27
  convertJsonToJSValue(value: unknown, context?: TransformContext): unknown;
25
28
  marshallArray(values: string[]): string;
package/MongoPlatform.js CHANGED
@@ -6,6 +6,10 @@ import { MongoSchemaGenerator } from './MongoSchemaGenerator.js';
6
6
  /** Platform implementation for MongoDB. */
7
7
  export class MongoPlatform extends Platform {
8
8
  exceptionConverter = new MongoExceptionConverter();
9
+ /** Mongo always sorts null and missing values lowest, and cannot be asked for anything else. */
10
+ sortsNullsLowest() {
11
+ return true;
12
+ }
9
13
  setConfig(config) {
10
14
  config.set('autoJoinOneToOneOwner', false);
11
15
  config.set('loadStrategy', 'select-in');
@@ -55,6 +59,9 @@ export class MongoPlatform extends Platform {
55
59
  preservesDatesInsideJson() {
56
60
  return true;
57
61
  }
62
+ supportsNullsOrdering() {
63
+ return false;
64
+ }
58
65
  convertJsonToDatabaseValue(value) {
59
66
  return Utils.copy(value);
60
67
  }
package/README.md CHANGED
@@ -24,6 +24,7 @@ npm install @mikro-orm/mysql # MySQL
24
24
  npm install @mikro-orm/mariadb # MariaDB
25
25
  npm install @mikro-orm/sqlite # SQLite
26
26
  npm install @mikro-orm/libsql # libSQL / Turso
27
+ npm install @mikro-orm/sql-js # sql.js (in-memory SQLite in WASM)
27
28
  npm install @mikro-orm/mongodb # MongoDB
28
29
  npm install @mikro-orm/mssql # MS SQL Server
29
30
  npm install @mikro-orm/oracledb # Oracle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/mongodb",
3
- "version": "7.1.16-dev.10",
3
+ "version": "7.1.16-dev.12",
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.1.15"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.16-dev.10"
56
+ "@mikro-orm/core": "7.1.16-dev.12"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"