@mikro-orm/mongodb 7.0.2-dev.12 → 7.0.2-dev.14
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.d.ts +4 -0
- package/MongoConnection.js +1 -0
- package/MongoDriver.d.ts +1 -0
- package/MongoDriver.js +1 -0
- package/MongoEntityRepository.d.ts +1 -0
- package/MongoEntityRepository.js +1 -0
- package/MongoExceptionConverter.d.ts +1 -0
- package/MongoExceptionConverter.js +1 -0
- package/MongoMikroORM.d.ts +2 -0
- package/MongoMikroORM.js +1 -0
- package/MongoPlatform.d.ts +1 -0
- package/MongoPlatform.js +1 -0
- package/MongoSchemaGenerator.d.ts +2 -0
- package/MongoSchemaGenerator.js +1 -0
- package/package.json +2 -2
package/MongoConnection.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ClientSession, type Collection, type Db, MongoClient, type MongoClientOptions, type TransactionOptions } from 'mongodb';
|
|
2
2
|
import { type AnyEntity, type CollationOptions, type Configuration, Connection, type ConnectionOptions, type ConnectionType, type Dictionary, type EntityData, type EntityName, type FilterQuery, type IsolationLevel, type LoggingOptions, type QueryOrderMap, type QueryResult, type Transaction, type TransactionEventBroadcaster, type UpsertManyOptions, type UpsertOptions } from '@mikro-orm/core';
|
|
3
|
+
/** MongoDB database connection using the official `mongodb` driver. */
|
|
3
4
|
export declare class MongoConnection extends Connection {
|
|
4
5
|
#private;
|
|
5
6
|
constructor(config: Configuration, options?: ConnectionOptions, type?: ConnectionType);
|
|
@@ -54,12 +55,14 @@ export declare class MongoConnection extends Connection {
|
|
|
54
55
|
private getCollectionName;
|
|
55
56
|
private logObject;
|
|
56
57
|
}
|
|
58
|
+
/** Options shared across MongoDB query operations. */
|
|
57
59
|
export interface MongoQueryOptions {
|
|
58
60
|
collation?: CollationOptions;
|
|
59
61
|
indexHint?: string | Dictionary;
|
|
60
62
|
maxTimeMS?: number;
|
|
61
63
|
allowDiskUse?: boolean;
|
|
62
64
|
}
|
|
65
|
+
/** Options for MongoDB find operations. */
|
|
63
66
|
export interface MongoFindOptions<T extends object> extends MongoQueryOptions {
|
|
64
67
|
orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[];
|
|
65
68
|
limit?: number;
|
|
@@ -68,6 +71,7 @@ export interface MongoFindOptions<T extends object> extends MongoQueryOptions {
|
|
|
68
71
|
ctx?: Transaction<ClientSession>;
|
|
69
72
|
loggerContext?: LoggingOptions;
|
|
70
73
|
}
|
|
74
|
+
/** Options for MongoDB count operations. */
|
|
71
75
|
export interface MongoCountOptions extends Omit<MongoQueryOptions, 'allowDiskUse'> {
|
|
72
76
|
ctx?: Transaction<ClientSession>;
|
|
73
77
|
loggerContext?: LoggingOptions;
|
package/MongoConnection.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MongoClient, ObjectId, } from 'mongodb';
|
|
2
2
|
import { Connection, EventType, inspect, QueryOrder, Utils, ValidationError, } from '@mikro-orm/core';
|
|
3
|
+
/** MongoDB database connection using the official `mongodb` driver. */
|
|
3
4
|
export class MongoConnection extends Connection {
|
|
4
5
|
#client;
|
|
5
6
|
#db;
|
package/MongoDriver.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { MongoConnection } from './MongoConnection.js';
|
|
|
4
4
|
import { MongoPlatform } from './MongoPlatform.js';
|
|
5
5
|
import { MongoEntityManager } from './MongoEntityManager.js';
|
|
6
6
|
import { MongoMikroORM } from './MongoMikroORM.js';
|
|
7
|
+
/** Database driver for MongoDB. */
|
|
7
8
|
export declare class MongoDriver extends DatabaseDriver<MongoConnection> {
|
|
8
9
|
[EntityManagerType]: MongoEntityManager<this>;
|
|
9
10
|
protected readonly connection: MongoConnection;
|
package/MongoDriver.js
CHANGED
|
@@ -4,6 +4,7 @@ import { MongoConnection } from './MongoConnection.js';
|
|
|
4
4
|
import { MongoPlatform } from './MongoPlatform.js';
|
|
5
5
|
import { MongoEntityManager } from './MongoEntityManager.js';
|
|
6
6
|
import { MongoMikroORM } from './MongoMikroORM.js';
|
|
7
|
+
/** Database driver for MongoDB. */
|
|
7
8
|
export class MongoDriver extends DatabaseDriver {
|
|
8
9
|
[EntityManagerType];
|
|
9
10
|
connection = new MongoConnection(this.config);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EntityRepository, type EntityName } from '@mikro-orm/core';
|
|
2
2
|
import type { Collection } from 'mongodb';
|
|
3
3
|
import type { MongoEntityManager } from './MongoEntityManager.js';
|
|
4
|
+
/** Entity repository with MongoDB-specific methods such as `aggregate()`. */
|
|
4
5
|
export declare class MongoEntityRepository<T extends object> extends EntityRepository<T> {
|
|
5
6
|
protected readonly em: MongoEntityManager;
|
|
6
7
|
constructor(em: MongoEntityManager, entityName: EntityName<T>);
|
package/MongoEntityRepository.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExceptionConverter, type Dictionary, type DriverException } from '@mikro-orm/core';
|
|
2
|
+
/** Converts MongoDB native errors into typed MikroORM driver exceptions. */
|
|
2
3
|
export declare class MongoExceptionConverter extends ExceptionConverter {
|
|
3
4
|
/**
|
|
4
5
|
* @see https://gist.github.com/rluvaton/a97a8da46ab6541a3e5702e83b9d357b
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UniqueConstraintViolationException, ExceptionConverter, TableExistsException, } from '@mikro-orm/core';
|
|
2
|
+
/** Converts MongoDB native errors into typed MikroORM driver exceptions. */
|
|
2
3
|
export class MongoExceptionConverter extends ExceptionConverter {
|
|
3
4
|
/**
|
|
4
5
|
* @see https://gist.github.com/rluvaton/a97a8da46ab6541a3e5702e83b9d357b
|
package/MongoMikroORM.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType, type IMigrator } from '@mikro-orm/core';
|
|
2
2
|
import { MongoDriver } from './MongoDriver.js';
|
|
3
3
|
import type { MongoEntityManager } from './MongoEntityManager.js';
|
|
4
|
+
/** Configuration options for the MongoDB driver. */
|
|
4
5
|
export type MongoOptions<EM extends MongoEntityManager = MongoEntityManager, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<MongoDriver, EM, Entities>>;
|
|
6
|
+
/** Creates a type-safe configuration object for the MongoDB driver. */
|
|
5
7
|
export declare function defineMongoConfig<EM extends MongoEntityManager = MongoEntityManager, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: MongoOptions<EM, Entities>): MongoOptions<EM, Entities>;
|
|
6
8
|
/**
|
|
7
9
|
* @inheritDoc
|
package/MongoMikroORM.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineConfig, MikroORM, } from '@mikro-orm/core';
|
|
2
2
|
import { MongoDriver } from './MongoDriver.js';
|
|
3
|
+
/** Creates a type-safe configuration object for the MongoDB driver. */
|
|
3
4
|
export function defineMongoConfig(options) {
|
|
4
5
|
return defineConfig({ driver: MongoDriver, ...options });
|
|
5
6
|
}
|
package/MongoPlatform.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ObjectId } from 'mongodb';
|
|
|
2
2
|
import { Platform, type IPrimaryKey, type Primary, type NamingStrategy, type Constructor, type EntityRepository, type EntityProperty, type PopulateOptions, type EntityMetadata, type IDatabaseDriver, type EntityManager, type Configuration, type MikroORM, type TransformContext } from '@mikro-orm/core';
|
|
3
3
|
import { MongoExceptionConverter } from './MongoExceptionConverter.js';
|
|
4
4
|
import { MongoSchemaGenerator } from './MongoSchemaGenerator.js';
|
|
5
|
+
/** Platform implementation for MongoDB. */
|
|
5
6
|
export declare class MongoPlatform extends Platform {
|
|
6
7
|
protected readonly exceptionConverter: MongoExceptionConverter;
|
|
7
8
|
setConfig(config: Configuration): void;
|
package/MongoPlatform.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Platform, MongoNamingStrategy, Utils, ReferenceKind, MetadataError, } f
|
|
|
3
3
|
import { MongoExceptionConverter } from './MongoExceptionConverter.js';
|
|
4
4
|
import { MongoEntityRepository } from './MongoEntityRepository.js';
|
|
5
5
|
import { MongoSchemaGenerator } from './MongoSchemaGenerator.js';
|
|
6
|
+
/** Platform implementation for MongoDB. */
|
|
6
7
|
export class MongoPlatform extends Platform {
|
|
7
8
|
exceptionConverter = new MongoExceptionConverter();
|
|
8
9
|
setConfig(config) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CreateSchemaOptions, type MikroORM } from '@mikro-orm/core';
|
|
2
2
|
import { AbstractSchemaGenerator } from '@mikro-orm/core/schema';
|
|
3
3
|
import type { MongoDriver } from './MongoDriver.js';
|
|
4
|
+
/** Schema generator for MongoDB that manages collections and indexes. */
|
|
4
5
|
export declare class MongoSchemaGenerator extends AbstractSchemaGenerator<MongoDriver> {
|
|
5
6
|
static register(orm: MikroORM): void;
|
|
6
7
|
create(options?: MongoCreateSchemaOptions): Promise<void>;
|
|
@@ -28,6 +29,7 @@ export interface MongoCreateSchemaOptions extends CreateSchemaOptions {
|
|
|
28
29
|
/** create indexes? defaults to true */
|
|
29
30
|
ensureIndexes?: boolean;
|
|
30
31
|
}
|
|
32
|
+
/** Options for the `ensureIndexes()` method of `MongoSchemaGenerator`. */
|
|
31
33
|
export interface EnsureIndexesOptions {
|
|
32
34
|
ensureCollections?: boolean;
|
|
33
35
|
retry?: boolean | string[];
|
package/MongoSchemaGenerator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Utils, inspect, } from '@mikro-orm/core';
|
|
2
2
|
import { AbstractSchemaGenerator } from '@mikro-orm/core/schema';
|
|
3
|
+
/** Schema generator for MongoDB that manages collections and indexes. */
|
|
3
4
|
export class MongoSchemaGenerator extends AbstractSchemaGenerator {
|
|
4
5
|
static register(orm) {
|
|
5
6
|
orm.config.registerExtension('@mikro-orm/schema-generator', () => new MongoSchemaGenerator(orm.em));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mongodb",
|
|
3
|
-
"version": "7.0.2-dev.
|
|
3
|
+
"version": "7.0.2-dev.14",
|
|
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.0.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.0.2-dev.
|
|
56
|
+
"@mikro-orm/core": "7.0.2-dev.14"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|