@mikro-orm/mongodb 7.0.4-dev.9 → 7.0.4
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 +143 -62
- package/MongoConnection.js +425 -420
- package/MongoDriver.d.ts +104 -32
- package/MongoDriver.js +431 -421
- package/MongoEntityManager.d.ts +44 -26
- 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 +55 -16
- package/MongoMikroORM.js +22 -22
- package/MongoPlatform.d.ts +39 -24
- package/MongoPlatform.js +83 -83
- package/MongoSchemaGenerator.d.ts +24 -26
- package/MongoSchemaGenerator.js +213 -209
- package/README.md +1 -1
- package/index.d.ts +5 -1
- package/index.js +1 -1
- package/package.json +3 -3
package/MongoConnection.d.ts
CHANGED
|
@@ -1,78 +1,159 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClientSession,
|
|
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';
|
|
3
29
|
/** MongoDB database connection using the official `mongodb` driver. */
|
|
4
30
|
export declare class MongoConnection extends Connection {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
checkConnection(): Promise<{
|
|
31
|
+
#private;
|
|
32
|
+
constructor(config: Configuration, options?: ConnectionOptions, type?: ConnectionType);
|
|
33
|
+
connect(options?: { skipOnConnect?: boolean }): Promise<void>;
|
|
34
|
+
createClient(): void;
|
|
35
|
+
close(force?: boolean): Promise<void>;
|
|
36
|
+
isConnected(): Promise<boolean>;
|
|
37
|
+
checkConnection(): Promise<
|
|
38
|
+
| {
|
|
14
39
|
ok: true;
|
|
15
|
-
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
16
42
|
ok: false;
|
|
17
43
|
reason: string;
|
|
18
44
|
error?: Error;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
}
|
|
46
|
+
>;
|
|
47
|
+
getClient(): MongoClient;
|
|
48
|
+
getCollection<T extends object>(name: EntityName<T> | string): Collection<T>;
|
|
49
|
+
createCollection<T extends object>(name: EntityName<T>): Promise<Collection<T>>;
|
|
50
|
+
listCollections(): Promise<string[]>;
|
|
51
|
+
dropCollection(name: EntityName<AnyEntity>): Promise<boolean>;
|
|
52
|
+
mapOptions(overrides: MongoClientOptions): MongoClientOptions;
|
|
53
|
+
getDb(): Db;
|
|
54
|
+
execute(query: string): Promise<any>;
|
|
55
|
+
find<T extends object>(
|
|
56
|
+
entityName: EntityName<T>,
|
|
57
|
+
where: FilterQuery<T>,
|
|
58
|
+
opts?: MongoFindOptions<T>,
|
|
59
|
+
): Promise<EntityData<T>[]>;
|
|
60
|
+
stream<T extends object>(
|
|
61
|
+
entityName: EntityName<T>,
|
|
62
|
+
where: FilterQuery<T>,
|
|
63
|
+
opts?: MongoFindOptions<T>,
|
|
64
|
+
): AsyncIterableIterator<T>;
|
|
65
|
+
private _find;
|
|
66
|
+
insertOne<T extends object>(
|
|
67
|
+
entityName: EntityName<T>,
|
|
68
|
+
data: Partial<T>,
|
|
69
|
+
ctx?: Transaction<ClientSession>,
|
|
70
|
+
): Promise<QueryResult<T>>;
|
|
71
|
+
insertMany<T extends object>(
|
|
72
|
+
entityName: EntityName<T>,
|
|
73
|
+
data: Partial<T>[],
|
|
74
|
+
ctx?: Transaction<ClientSession>,
|
|
75
|
+
): Promise<QueryResult<T>>;
|
|
76
|
+
updateMany<T extends object>(
|
|
77
|
+
entityName: EntityName<T>,
|
|
78
|
+
where: FilterQuery<T>,
|
|
79
|
+
data: Partial<T>,
|
|
80
|
+
ctx?: Transaction<ClientSession>,
|
|
81
|
+
upsert?: boolean,
|
|
82
|
+
upsertOptions?: UpsertOptions<T>,
|
|
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;
|
|
57
138
|
}
|
|
58
139
|
/** Options shared across MongoDB query operations. */
|
|
59
140
|
export interface MongoQueryOptions {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
141
|
+
collation?: CollationOptions;
|
|
142
|
+
indexHint?: string | Dictionary;
|
|
143
|
+
maxTimeMS?: number;
|
|
144
|
+
allowDiskUse?: boolean;
|
|
64
145
|
}
|
|
65
146
|
/** Options for MongoDB find operations. */
|
|
66
147
|
export interface MongoFindOptions<T extends object> extends MongoQueryOptions {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
148
|
+
orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[];
|
|
149
|
+
limit?: number;
|
|
150
|
+
offset?: number;
|
|
151
|
+
fields?: string[];
|
|
152
|
+
ctx?: Transaction<ClientSession>;
|
|
153
|
+
loggerContext?: LoggingOptions;
|
|
73
154
|
}
|
|
74
155
|
/** Options for MongoDB count operations. */
|
|
75
156
|
export interface MongoCountOptions extends Omit<MongoQueryOptions, 'allowDiskUse'> {
|
|
76
|
-
|
|
77
|
-
|
|
157
|
+
ctx?: Transaction<ClientSession>;
|
|
158
|
+
loggerContext?: LoggingOptions;
|
|
78
159
|
}
|