@mikro-orm/mongodb 7.0.5 → 7.0.6-dev.1
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 +62 -143
- package/MongoConnection.js +420 -425
- package/MongoDriver.d.ts +32 -104
- package/MongoDriver.js +421 -431
- package/MongoEntityManager.d.ts +26 -44
- package/MongoEntityManager.js +42 -42
- package/MongoEntityRepository.d.ts +11 -11
- package/MongoEntityRepository.js +20 -20
- package/MongoExceptionConverter.d.ts +4 -4
- package/MongoExceptionConverter.js +13 -13
- package/MongoMikroORM.d.ts +16 -55
- package/MongoMikroORM.js +22 -22
- package/MongoPlatform.d.ts +24 -39
- package/MongoPlatform.js +83 -83
- package/MongoSchemaGenerator.d.ts +26 -24
- package/MongoSchemaGenerator.js +209 -213
- package/README.md +1 -1
- package/index.d.ts +1 -5
- package/index.js +1 -1
- package/package.json +2 -2
package/MongoConnection.d.ts
CHANGED
|
@@ -1,159 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type Collection,
|
|
4
|
-
type Db,
|
|
5
|
-
MongoClient,
|
|
6
|
-
type MongoClientOptions,
|
|
7
|
-
type TransactionOptions,
|
|
8
|
-
} from 'mongodb';
|
|
9
|
-
import {
|
|
10
|
-
type AnyEntity,
|
|
11
|
-
type CollationOptions,
|
|
12
|
-
type Configuration,
|
|
13
|
-
Connection,
|
|
14
|
-
type ConnectionOptions,
|
|
15
|
-
type ConnectionType,
|
|
16
|
-
type Dictionary,
|
|
17
|
-
type EntityData,
|
|
18
|
-
type EntityName,
|
|
19
|
-
type FilterQuery,
|
|
20
|
-
type IsolationLevel,
|
|
21
|
-
type LoggingOptions,
|
|
22
|
-
type QueryOrderMap,
|
|
23
|
-
type QueryResult,
|
|
24
|
-
type Transaction,
|
|
25
|
-
type TransactionEventBroadcaster,
|
|
26
|
-
type UpsertManyOptions,
|
|
27
|
-
type UpsertOptions,
|
|
28
|
-
} from '@mikro-orm/core';
|
|
1
|
+
import { type ClientSession, type Collection, type Db, MongoClient, type MongoClientOptions, type TransactionOptions } from 'mongodb';
|
|
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';
|
|
29
3
|
/** MongoDB database connection using the official `mongodb` driver. */
|
|
30
4
|
export declare class MongoConnection extends Connection {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: Configuration, options?: ConnectionOptions, type?: ConnectionType);
|
|
7
|
+
connect(options?: {
|
|
8
|
+
skipOnConnect?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
createClient(): void;
|
|
11
|
+
close(force?: boolean): Promise<void>;
|
|
12
|
+
isConnected(): Promise<boolean>;
|
|
13
|
+
checkConnection(): Promise<{
|
|
39
14
|
ok: true;
|
|
40
|
-
|
|
41
|
-
| {
|
|
15
|
+
} | {
|
|
42
16
|
ok: false;
|
|
43
17
|
reason: string;
|
|
44
18
|
error?: Error;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
entityName: EntityName<T>,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
): Promise<QueryResult<T>>;
|
|
84
|
-
bulkUpdateMany<T extends object>(
|
|
85
|
-
entityName: EntityName<T>,
|
|
86
|
-
where: FilterQuery<T>[],
|
|
87
|
-
data: Partial<T>[],
|
|
88
|
-
ctx?: Transaction<ClientSession>,
|
|
89
|
-
upsert?: boolean,
|
|
90
|
-
upsertOptions?: UpsertManyOptions<T>,
|
|
91
|
-
): Promise<QueryResult<T>>;
|
|
92
|
-
deleteMany<T extends object>(
|
|
93
|
-
entityName: EntityName<T>,
|
|
94
|
-
where: FilterQuery<T>,
|
|
95
|
-
ctx?: Transaction<ClientSession>,
|
|
96
|
-
): Promise<QueryResult<T>>;
|
|
97
|
-
aggregate<T extends object = any>(
|
|
98
|
-
entityName: EntityName<T>,
|
|
99
|
-
pipeline: any[],
|
|
100
|
-
ctx?: Transaction<ClientSession>,
|
|
101
|
-
loggerContext?: LoggingOptions,
|
|
102
|
-
): Promise<T[]>;
|
|
103
|
-
streamAggregate<T extends object>(
|
|
104
|
-
entityName: EntityName<T>,
|
|
105
|
-
pipeline: any[],
|
|
106
|
-
ctx?: Transaction<ClientSession>,
|
|
107
|
-
loggerContext?: LoggingOptions,
|
|
108
|
-
stream?: boolean,
|
|
109
|
-
): AsyncIterableIterator<T>;
|
|
110
|
-
countDocuments<T extends object>(
|
|
111
|
-
entityName: EntityName<T>,
|
|
112
|
-
where: FilterQuery<T>,
|
|
113
|
-
opts?: MongoCountOptions,
|
|
114
|
-
): Promise<number>;
|
|
115
|
-
transactional<T>(
|
|
116
|
-
cb: (trx: Transaction<ClientSession>) => Promise<T>,
|
|
117
|
-
options?: {
|
|
118
|
-
isolationLevel?: IsolationLevel;
|
|
119
|
-
ctx?: Transaction<ClientSession>;
|
|
120
|
-
eventBroadcaster?: TransactionEventBroadcaster;
|
|
121
|
-
} & TransactionOptions,
|
|
122
|
-
): Promise<T>;
|
|
123
|
-
begin(
|
|
124
|
-
options?: {
|
|
125
|
-
isolationLevel?: IsolationLevel;
|
|
126
|
-
ctx?: ClientSession;
|
|
127
|
-
eventBroadcaster?: TransactionEventBroadcaster;
|
|
128
|
-
} & TransactionOptions,
|
|
129
|
-
): Promise<ClientSession>;
|
|
130
|
-
commit(ctx: ClientSession, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
131
|
-
rollback(ctx: ClientSession, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
132
|
-
private runQuery;
|
|
133
|
-
private rethrow;
|
|
134
|
-
private createUpdatePayload;
|
|
135
|
-
private transformResult;
|
|
136
|
-
private getCollectionName;
|
|
137
|
-
private logObject;
|
|
19
|
+
}>;
|
|
20
|
+
getClient(): MongoClient;
|
|
21
|
+
getCollection<T extends object>(name: EntityName<T> | string): Collection<T>;
|
|
22
|
+
createCollection<T extends object>(name: EntityName<T>): Promise<Collection<T>>;
|
|
23
|
+
listCollections(): Promise<string[]>;
|
|
24
|
+
dropCollection(name: EntityName<AnyEntity>): Promise<boolean>;
|
|
25
|
+
mapOptions(overrides: MongoClientOptions): MongoClientOptions;
|
|
26
|
+
getDb(): Db;
|
|
27
|
+
execute(query: string): Promise<any>;
|
|
28
|
+
find<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, opts?: MongoFindOptions<T>): Promise<EntityData<T>[]>;
|
|
29
|
+
stream<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, opts?: MongoFindOptions<T>): AsyncIterableIterator<T>;
|
|
30
|
+
private _find;
|
|
31
|
+
insertOne<T extends object>(entityName: EntityName<T>, data: Partial<T>, ctx?: Transaction<ClientSession>): Promise<QueryResult<T>>;
|
|
32
|
+
insertMany<T extends object>(entityName: EntityName<T>, data: Partial<T>[], ctx?: Transaction<ClientSession>): Promise<QueryResult<T>>;
|
|
33
|
+
updateMany<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, data: Partial<T>, ctx?: Transaction<ClientSession>, upsert?: boolean, upsertOptions?: UpsertOptions<T>): Promise<QueryResult<T>>;
|
|
34
|
+
bulkUpdateMany<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>[], data: Partial<T>[], ctx?: Transaction<ClientSession>, upsert?: boolean, upsertOptions?: UpsertManyOptions<T>): Promise<QueryResult<T>>;
|
|
35
|
+
deleteMany<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, ctx?: Transaction<ClientSession>): Promise<QueryResult<T>>;
|
|
36
|
+
aggregate<T extends object = any>(entityName: EntityName<T>, pipeline: any[], ctx?: Transaction<ClientSession>, loggerContext?: LoggingOptions): Promise<T[]>;
|
|
37
|
+
streamAggregate<T extends object>(entityName: EntityName<T>, pipeline: any[], ctx?: Transaction<ClientSession>, loggerContext?: LoggingOptions, stream?: boolean): AsyncIterableIterator<T>;
|
|
38
|
+
countDocuments<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, opts?: MongoCountOptions): Promise<number>;
|
|
39
|
+
transactional<T>(cb: (trx: Transaction<ClientSession>) => Promise<T>, options?: {
|
|
40
|
+
isolationLevel?: IsolationLevel;
|
|
41
|
+
ctx?: Transaction<ClientSession>;
|
|
42
|
+
eventBroadcaster?: TransactionEventBroadcaster;
|
|
43
|
+
} & TransactionOptions): Promise<T>;
|
|
44
|
+
begin(options?: {
|
|
45
|
+
isolationLevel?: IsolationLevel;
|
|
46
|
+
ctx?: ClientSession;
|
|
47
|
+
eventBroadcaster?: TransactionEventBroadcaster;
|
|
48
|
+
} & TransactionOptions): Promise<ClientSession>;
|
|
49
|
+
commit(ctx: ClientSession, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
50
|
+
rollback(ctx: ClientSession, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
51
|
+
private runQuery;
|
|
52
|
+
private rethrow;
|
|
53
|
+
private createUpdatePayload;
|
|
54
|
+
private transformResult;
|
|
55
|
+
private getCollectionName;
|
|
56
|
+
private logObject;
|
|
138
57
|
}
|
|
139
58
|
/** Options shared across MongoDB query operations. */
|
|
140
59
|
export interface MongoQueryOptions {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
60
|
+
collation?: CollationOptions;
|
|
61
|
+
indexHint?: string | Dictionary;
|
|
62
|
+
maxTimeMS?: number;
|
|
63
|
+
allowDiskUse?: boolean;
|
|
145
64
|
}
|
|
146
65
|
/** Options for MongoDB find operations. */
|
|
147
66
|
export interface MongoFindOptions<T extends object> extends MongoQueryOptions {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
67
|
+
orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[];
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
fields?: string[];
|
|
71
|
+
ctx?: Transaction<ClientSession>;
|
|
72
|
+
loggerContext?: LoggingOptions;
|
|
154
73
|
}
|
|
155
74
|
/** Options for MongoDB count operations. */
|
|
156
75
|
export interface MongoCountOptions extends Omit<MongoQueryOptions, 'allowDiskUse'> {
|
|
157
|
-
|
|
158
|
-
|
|
76
|
+
ctx?: Transaction<ClientSession>;
|
|
77
|
+
loggerContext?: LoggingOptions;
|
|
159
78
|
}
|