@opra/mongodb 1.26.3 → 1.26.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/README.md +24 -1
- package/adapter/mongo-adapter.d.ts +45 -0
- package/adapter/mongo-adapter.js +23 -0
- package/adapter/mongo-patch-generator.d.ts +12 -0
- package/adapter/mongo-patch-generator.js +22 -10
- package/adapter/prepare-filter.d.ts +4 -6
- package/adapter/prepare-filter.js +4 -6
- package/adapter/prepare-key-values.d.ts +9 -0
- package/adapter/prepare-key-values.js +9 -0
- package/adapter/prepare-projection.d.ts +8 -0
- package/adapter/prepare-projection.js +13 -5
- package/adapter/prepare-sort.d.ts +6 -0
- package/adapter/prepare-sort.js +6 -0
- package/package.json +4 -4
- package/services/mongo-collection-service.d.ts +133 -84
- package/services/mongo-collection-service.js +36 -38
- package/services/mongo-entity-service.d.ts +71 -23
- package/services/mongo-entity-service.js +39 -40
- package/services/mongo-nested-service.d.ts +136 -87
- package/services/mongo-nested-service.js +62 -70
- package/services/mongo-service.d.ts +60 -34
- package/services/mongo-service.js +10 -15
- package/services/mongo-singleton-service.d.ts +49 -46
- package/services/mongo-singleton-service.js +25 -28
- package/types.d.ts +9 -3
|
@@ -7,45 +7,93 @@ import type { MongoPatchDTO } from '../types.js';
|
|
|
7
7
|
import type { MongoEntityService } from './mongo-entity-service.js';
|
|
8
8
|
import { MongoService } from './mongo-service.js';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @namespace MongoNestedService
|
|
10
|
+
* Options for MongoNestedService.
|
|
12
11
|
*/
|
|
13
12
|
export declare namespace MongoNestedService {
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
14
|
+
* Configuration options for MongoNestedService.
|
|
16
15
|
*/
|
|
17
16
|
interface Options extends MongoService.Options {
|
|
17
|
+
/**
|
|
18
|
+
* Default maximum number of records returned by `findMany`.
|
|
19
|
+
*/
|
|
18
20
|
defaultLimit?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The field name of the primary key in the nested collection.
|
|
23
|
+
*/
|
|
19
24
|
nestedKey?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional filter for nested operations.
|
|
27
|
+
*/
|
|
20
28
|
nestedFilter?: MongoAdapter.FilterInput | ((args: MongoService.CommandInfo, _this: this) => MongoAdapter.FilterInput | Promise<MongoAdapter.FilterInput> | undefined);
|
|
21
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Information about the command being executed.
|
|
32
|
+
*/
|
|
22
33
|
interface CommandInfo extends MongoService.CommandInfo {
|
|
23
34
|
}
|
|
24
35
|
interface CreateOptions extends MongoService.CreateOptions {
|
|
25
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Options for the `count` operation.
|
|
39
|
+
* @template T - The type of the document.
|
|
40
|
+
*/
|
|
26
41
|
interface CountOptions<T> extends MongoService.CountOptions<T> {
|
|
27
42
|
documentFilter?: MongoAdapter.FilterInput;
|
|
28
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for the `delete` operation.
|
|
46
|
+
* @template T - The type of the document.
|
|
47
|
+
*/
|
|
29
48
|
interface DeleteOptions<T> extends MongoService.DeleteOptions<T> {
|
|
30
49
|
documentFilter?: MongoAdapter.FilterInput;
|
|
31
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Options for the `deleteMany` operation.
|
|
53
|
+
* @template T - The type of the document.
|
|
54
|
+
*/
|
|
32
55
|
interface DeleteManyOptions<T> extends MongoService.DeleteManyOptions<T> {
|
|
33
56
|
documentFilter?: MongoAdapter.FilterInput;
|
|
34
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for the `exists` operation.
|
|
60
|
+
* @template T - The type of the document.
|
|
61
|
+
*/
|
|
35
62
|
interface ExistsOptions<T> extends MongoService.ExistsOptions<T> {
|
|
36
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Options for the `findOne` / `findById` operations.
|
|
66
|
+
* @template T - The type of the document.
|
|
67
|
+
*/
|
|
37
68
|
interface FindOneOptions<T> extends MongoService.FindOneOptions<T> {
|
|
38
69
|
documentFilter?: MongoAdapter.FilterInput;
|
|
39
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Options for the `findMany` operation.
|
|
73
|
+
*
|
|
74
|
+
* @template T - The type of the document.
|
|
75
|
+
*/
|
|
40
76
|
interface FindManyOptions<T> extends MongoService.FindManyOptions<T> {
|
|
41
77
|
documentFilter?: MongoAdapter.FilterInput;
|
|
42
78
|
nestedFilter?: MongoAdapter.FilterInput;
|
|
43
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Options for the `update` / `updateOnly` operations.
|
|
82
|
+
*
|
|
83
|
+
* @template T - The type of the document.
|
|
84
|
+
*/
|
|
44
85
|
interface UpdateOneOptions<T> extends MongoService.UpdateOneOptions<T> {
|
|
45
86
|
documentFilter?: MongoAdapter.FilterInput;
|
|
87
|
+
initArrayFields?: string[];
|
|
46
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Options for the `updateMany` operation.
|
|
91
|
+
*
|
|
92
|
+
* @template T - The type of the document.
|
|
93
|
+
*/
|
|
47
94
|
interface UpdateManyOptions<T> extends MongoService.UpdateManyOptions<T> {
|
|
48
95
|
documentFilter?: MongoAdapter.FilterInput;
|
|
96
|
+
initArrayFields?: string[];
|
|
49
97
|
}
|
|
50
98
|
interface CreateCommand<T> extends RequiredSome<CommandInfo, 'documentId' | 'input'> {
|
|
51
99
|
crud: 'create';
|
|
@@ -91,51 +139,43 @@ export declare namespace MongoNestedService {
|
|
|
91
139
|
export declare class MongoNestedService<T extends mongodb.Document> extends MongoService<T> {
|
|
92
140
|
/**
|
|
93
141
|
* Represents the name of the array field in parent document
|
|
94
|
-
*
|
|
95
|
-
* @type {string}
|
|
96
142
|
*/
|
|
97
143
|
fieldName: string;
|
|
98
144
|
/**
|
|
99
145
|
* Represents the value of a nested array key field
|
|
100
|
-
*
|
|
101
|
-
* @type {string}
|
|
102
146
|
*/
|
|
103
147
|
nestedKey: string;
|
|
104
148
|
/**
|
|
105
149
|
* Represents the default limit value for a certain operation.
|
|
106
|
-
*
|
|
107
|
-
* @type {number}
|
|
108
150
|
*/
|
|
109
151
|
defaultLimit: number;
|
|
110
152
|
/**
|
|
111
153
|
* Represents a common array filter function
|
|
112
|
-
*
|
|
113
|
-
* @type {FilterInput | Function}
|
|
114
154
|
*/
|
|
115
155
|
nestedFilter?: MongoAdapter.FilterInput | ((args: MongoService.CommandInfo, _this: this) => MongoAdapter.FilterInput | Promise<MongoAdapter.FilterInput> | undefined);
|
|
116
156
|
/**
|
|
117
157
|
* Constructs a new instance
|
|
118
158
|
*
|
|
119
|
-
* @param
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
159
|
+
* @param dataType - The data type of the array elements.
|
|
160
|
+
* @param fieldName - The name of the field in the document representing the array.
|
|
161
|
+
* @param [options] - The options for the array service.
|
|
122
162
|
* @constructor
|
|
123
163
|
*/
|
|
124
164
|
constructor(dataType: Type | string, fieldName: string, options?: MongoNestedService.Options);
|
|
125
165
|
/**
|
|
126
|
-
* Retrieves the data type of the array field
|
|
166
|
+
* Retrieves the data type of the array field.
|
|
127
167
|
*
|
|
128
|
-
* @returns
|
|
129
|
-
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
168
|
+
* @returns The complex data type of the field.
|
|
169
|
+
* @throws {@link NotAcceptableError} If the data type is not a ComplexType.
|
|
130
170
|
*/
|
|
131
171
|
get dataType(): ComplexType;
|
|
132
172
|
/**
|
|
133
173
|
* Create a copy of this instance with given properties and context applied.
|
|
134
174
|
*
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
* @
|
|
175
|
+
* @param context - The execution context or service base to associate with this instance.
|
|
176
|
+
* @param [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
177
|
+
* @param [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
178
|
+
* @returns The current instance with the specified properties and context applied.
|
|
139
179
|
* @template P
|
|
140
180
|
* @template C
|
|
141
181
|
*/
|
|
@@ -144,87 +184,87 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
144
184
|
* Asserts whether a resource with the specified parentId and id exists.
|
|
145
185
|
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
146
186
|
*
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
150
|
-
* @
|
|
151
|
-
* @throws {ResourceNotAvailableError} - If the resource does not exist.
|
|
187
|
+
* @param documentId - The ID of the parent document.
|
|
188
|
+
* @param id - The ID of the resource.
|
|
189
|
+
* @param options - Optional parameters for checking resource existence.
|
|
190
|
+
* @returns A promise that resolves with no value upon success.
|
|
191
|
+
* @throws {@link ResourceNotAvailableError} - If the resource does not exist.
|
|
152
192
|
*/
|
|
153
193
|
assert(documentId: MongoAdapter.AnyId, id: MongoAdapter.AnyId, options?: MongoNestedService.ExistsOptions<T>): Promise<void>;
|
|
154
194
|
/**
|
|
155
195
|
* Adds a single item into the array field.
|
|
156
196
|
*
|
|
157
|
-
* @param
|
|
158
|
-
* @param
|
|
159
|
-
* @param
|
|
160
|
-
* @
|
|
161
|
-
* @throws {ResourceNotAvailableError} - If the parent document is not found.
|
|
197
|
+
* @param documentId - The ID of the parent document.
|
|
198
|
+
* @param input - The item to be added to the array field.
|
|
199
|
+
* @param options - Optional options for the create operation.
|
|
200
|
+
* @returns A promise that resolves with the partial output of the created item.
|
|
201
|
+
* @throws {@link ResourceNotAvailableError} - If the parent document is not found.
|
|
162
202
|
*/
|
|
163
203
|
create(documentId: MongoAdapter.AnyId, input: PartialDTO<T>, options: RequiredSome<MongoNestedService.CreateOptions, 'projection'>): Promise<PartialDTO<T>>;
|
|
164
204
|
create(documentId: MongoAdapter.AnyId, input: PartialDTO<T>, options?: MongoNestedService.CreateOptions): Promise<T>;
|
|
165
205
|
/**
|
|
166
206
|
* Adds a single item into the array field.
|
|
167
207
|
*
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
170
|
-
* @param
|
|
171
|
-
* @
|
|
172
|
-
* @throws {ResourceNotAvailableError} - If the parent document is not found.
|
|
208
|
+
* @param documentId - The ID of the parent document.
|
|
209
|
+
* @param input - The item to be added to the array field.
|
|
210
|
+
* @param [options] - Optional options for the create operation.
|
|
211
|
+
* @returns A promise that resolves create operation result
|
|
212
|
+
* @throws {@link ResourceNotAvailableError} - If the parent document is not found.
|
|
173
213
|
*/
|
|
174
214
|
createOnly(documentId: MongoAdapter.AnyId, input: DTO<T>, options?: MongoNestedService.CreateOptions): Promise<PartialDTO<T>>;
|
|
175
215
|
protected _create(command: MongoNestedService.CreateCommand<T>): Promise<T>;
|
|
176
216
|
/**
|
|
177
217
|
* Counts the number of documents in the collection that match the specified parentId and options.
|
|
178
218
|
*
|
|
179
|
-
* @param
|
|
180
|
-
* @param
|
|
181
|
-
* @returns
|
|
219
|
+
* @param documentId - The ID of the parent document.
|
|
220
|
+
* @param [options] - Optional parameters for counting.
|
|
221
|
+
* @returns A promise that resolves to the count of documents.
|
|
182
222
|
*/
|
|
183
223
|
count(documentId: MongoAdapter.AnyId, options?: MongoNestedService.CountOptions<T>): Promise<number>;
|
|
184
224
|
protected _count(command: MongoNestedService.CountCommand<T>): Promise<number>;
|
|
185
225
|
/**
|
|
186
226
|
* Deletes an element from an array within a document in the MongoDB collection.
|
|
187
227
|
*
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @
|
|
228
|
+
* @param documentId - The ID of the parent document.
|
|
229
|
+
* @param nestedId - The ID of the element to delete from the nested array.
|
|
230
|
+
* @param [options] - Additional options for the delete operation.
|
|
231
|
+
* @returns A Promise that resolves to the number of elements deleted (1 if successful, 0 if not).
|
|
192
232
|
*/
|
|
193
233
|
delete(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options?: MongoNestedService.DeleteOptions<T>): Promise<number>;
|
|
194
234
|
protected _delete(command: MongoNestedService.DeleteCommand<T>): Promise<number>;
|
|
195
235
|
/**
|
|
196
236
|
* Deletes multiple items from a collection based on the parent ID and optional filter.
|
|
197
237
|
*
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @returns
|
|
238
|
+
* @param documentId - The ID of the parent document.
|
|
239
|
+
* @param [options] - Optional options to specify a filter.
|
|
240
|
+
* @returns A Promise that resolves to the number of items deleted.
|
|
201
241
|
*/
|
|
202
242
|
deleteMany(documentId: MongoAdapter.AnyId, options?: MongoNestedService.DeleteManyOptions<T>): Promise<number>;
|
|
203
243
|
protected _deleteMany(command: MongoNestedService.DeleteCommand<T>): Promise<number>;
|
|
204
244
|
/**
|
|
205
245
|
* Checks if an array element with the given parentId and id exists.
|
|
206
246
|
*
|
|
207
|
-
* @param
|
|
208
|
-
* @param
|
|
209
|
-
* @param
|
|
210
|
-
* @returns
|
|
247
|
+
* @param documentId - The ID of the parent document.
|
|
248
|
+
* @param nestedId - The id of the record.
|
|
249
|
+
* @param [options] - The options for the exists method.
|
|
250
|
+
* @returns A promise that resolves to a boolean indicating if the record exists or not.
|
|
211
251
|
*/
|
|
212
252
|
exists(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options?: MongoNestedService.ExistsOptions<T>): Promise<boolean>;
|
|
213
253
|
/**
|
|
214
254
|
* Checks if an object with the given arguments exists.
|
|
215
255
|
*
|
|
216
|
-
* @param
|
|
217
|
-
* @param
|
|
218
|
-
* @
|
|
256
|
+
* @param documentId - The ID of the parent document.
|
|
257
|
+
* @param [options] - The options for the query (optional).
|
|
258
|
+
* @returns A Promise that resolves to a boolean indicating whether the object exists or not.
|
|
219
259
|
*/
|
|
220
260
|
existsOne(documentId: MongoAdapter.AnyId, options?: MongoNestedService.ExistsOptions<T>): Promise<boolean>;
|
|
221
261
|
/**
|
|
222
262
|
* Finds an element in array field by its parent ID and ID.
|
|
223
263
|
*
|
|
224
|
-
* @param
|
|
225
|
-
* @param
|
|
226
|
-
* @param
|
|
227
|
-
* @returns
|
|
264
|
+
* @param documentId - The ID of the document.
|
|
265
|
+
* @param nestedId - The ID of the document.
|
|
266
|
+
* @param [options] - The optional options for the operation.
|
|
267
|
+
* @returns A promise that resolves to the found document or undefined if not found.
|
|
228
268
|
*/
|
|
229
269
|
findById(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options: RequiredSome<MongoNestedService.FindOneOptions<T>, 'projection'>): Promise<PartialDTO<T> | undefined>;
|
|
230
270
|
findById(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options?: MongoNestedService.FindOneOptions<T>): Promise<T | undefined>;
|
|
@@ -232,9 +272,9 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
232
272
|
/**
|
|
233
273
|
* Finds the first array element that matches the given parentId.
|
|
234
274
|
*
|
|
235
|
-
* @param
|
|
236
|
-
* @param
|
|
237
|
-
* @returns
|
|
275
|
+
* @param documentId - The ID of the document.
|
|
276
|
+
* @param [options] - Optional options to customize the query.
|
|
277
|
+
* @returns A promise that resolves to the first matching document, or `undefined` if no match is found.
|
|
238
278
|
*/
|
|
239
279
|
findOne(documentId: MongoAdapter.AnyId, options: RequiredSome<MongoNestedService.FindOneOptions<T>, 'projection'>): Promise<PartialDTO<T> | undefined>;
|
|
240
280
|
findOne(documentId: MongoAdapter.AnyId, options?: MongoNestedService.FindOneOptions<T>): Promise<T | undefined>;
|
|
@@ -242,9 +282,9 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
242
282
|
/**
|
|
243
283
|
* Finds multiple elements in an array field.
|
|
244
284
|
*
|
|
245
|
-
* @param
|
|
246
|
-
* @param
|
|
247
|
-
* @returns
|
|
285
|
+
* @param documentId - The ID of the parent document.
|
|
286
|
+
* @param [options] - The options for finding the documents.
|
|
287
|
+
* @returns The found documents.
|
|
248
288
|
*/
|
|
249
289
|
findMany(documentId: MongoAdapter.AnyId, options: RequiredSome<MongoNestedService.FindManyOptions<T>, 'projection'>): Promise<PartialDTO<T>[]>;
|
|
250
290
|
findMany(documentId: MongoAdapter.AnyId, options?: MongoNestedService.FindManyOptions<T>): Promise<T[]>;
|
|
@@ -252,9 +292,9 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
252
292
|
/**
|
|
253
293
|
* Finds multiple elements in an array field.
|
|
254
294
|
*
|
|
255
|
-
* @param
|
|
256
|
-
* @param
|
|
257
|
-
* @returns
|
|
295
|
+
* @param documentId - The ID of the parent document.
|
|
296
|
+
* @param [options] - The options for finding the documents.
|
|
297
|
+
* @returns The found documents.
|
|
258
298
|
*/
|
|
259
299
|
findManyWithCount(documentId: MongoAdapter.AnyId, options: RequiredSome<MongoNestedService.FindManyOptions<T>, 'projection'>): Promise<{
|
|
260
300
|
count: number;
|
|
@@ -271,44 +311,53 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
271
311
|
/**
|
|
272
312
|
* Retrieves a specific item from the array of a document.
|
|
273
313
|
*
|
|
274
|
-
* @param
|
|
275
|
-
* @param
|
|
276
|
-
* @param
|
|
277
|
-
* @returns
|
|
278
|
-
* @throws {ResourceNotAvailableError} - If the item is not found.
|
|
314
|
+
* @param documentId - The ID of the document.
|
|
315
|
+
* @param nestedId - The ID of the item.
|
|
316
|
+
* @param options - Options including a required `projection`.
|
|
317
|
+
* @returns A promise that resolves to the retrieved document as a partial DTO.
|
|
318
|
+
* @throws {@link ResourceNotAvailableError} - If the item is not found.
|
|
279
319
|
*/
|
|
280
320
|
get(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options: RequiredSome<MongoNestedService.FindOneOptions<T>, 'projection'>): Promise<PartialDTO<T>>;
|
|
321
|
+
/**
|
|
322
|
+
* Retrieves a specific item from the array of a document and returns it as a full DTO.
|
|
323
|
+
*
|
|
324
|
+
* @param documentId - The ID of the document.
|
|
325
|
+
* @param nestedId - The ID of the item.
|
|
326
|
+
* @param options - Optional query options.
|
|
327
|
+
* @returns A promise that resolves to the retrieved document as a full DTO.
|
|
328
|
+
* @throws {@link ResourceNotAvailableError} - If the item is not found.
|
|
329
|
+
*/
|
|
281
330
|
get(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, options?: MongoNestedService.FindOneOptions<T>): Promise<T>;
|
|
282
331
|
/**
|
|
283
332
|
* Updates an array element with new data and returns the updated element
|
|
284
333
|
*
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
287
|
-
* @param
|
|
288
|
-
* @param
|
|
289
|
-
* @returns
|
|
290
|
-
* @throws {Error} If an error occurs while updating the item.
|
|
334
|
+
* @param documentId - The ID of the document to update.
|
|
335
|
+
* @param nestedId - The ID of the item to update within the document.
|
|
336
|
+
* @param input - The new data to update the item with.
|
|
337
|
+
* @param [options] - Additional update options.
|
|
338
|
+
* @returns The updated item or undefined if it does not exist.
|
|
339
|
+
* @throws {@link Error} If an error occurs while updating the item.
|
|
291
340
|
*/
|
|
292
341
|
update(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, input: MongoPatchDTO<T>, options: RequiredSome<MongoNestedService.UpdateOneOptions<T>, 'projection'>): Promise<PartialDTO<T> | undefined>;
|
|
293
342
|
update(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, input: MongoPatchDTO<T>, options?: MongoNestedService.UpdateOneOptions<T>): Promise<T | undefined>;
|
|
294
343
|
/**
|
|
295
344
|
* Update an array element with new data. Returns 1 if document updated 0 otherwise.
|
|
296
345
|
*
|
|
297
|
-
* @param
|
|
298
|
-
* @param
|
|
299
|
-
* @param
|
|
300
|
-
* @param
|
|
301
|
-
* @returns
|
|
346
|
+
* @param documentId - The ID of the parent document.
|
|
347
|
+
* @param nestedId - The ID of the document to update.
|
|
348
|
+
* @param input - The partial input object containing the fields to update.
|
|
349
|
+
* @param [options] - Optional update options.
|
|
350
|
+
* @returns A promise that resolves to the number of elements updated.
|
|
302
351
|
*/
|
|
303
352
|
updateOnly(documentId: MongoAdapter.AnyId, nestedId: MongoAdapter.AnyId, input: MongoPatchDTO<T>, options?: MongoNestedService.UpdateOneOptions<T>): Promise<number>;
|
|
304
353
|
protected _updateOnly(command: MongoNestedService.UpdateOneCommand<T>): Promise<number>;
|
|
305
354
|
/**
|
|
306
355
|
* Updates multiple array elements in document
|
|
307
356
|
*
|
|
308
|
-
* @param
|
|
309
|
-
* @param
|
|
310
|
-
* @param
|
|
311
|
-
* @returns
|
|
357
|
+
* @param documentId - The ID of the document to update.
|
|
358
|
+
* @param input - The updated data for the document(s).
|
|
359
|
+
* @param [options] - Additional options for the update operation.
|
|
360
|
+
* @returns A promise that resolves to the number of documents updated.
|
|
312
361
|
*/
|
|
313
362
|
updateMany(documentId: MongoAdapter.AnyId, input: MongoPatchDTO<T>, options?: MongoNestedService.UpdateManyOptions<T>): Promise<number>;
|
|
314
363
|
protected _updateMany(command: MongoNestedService.UpdateManyCommand<T>): Promise<number>;
|
|
@@ -317,7 +366,7 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
317
366
|
* This method is mostly used for security issues like securing multi-tenant applications.
|
|
318
367
|
*
|
|
319
368
|
* @protected
|
|
320
|
-
* @returns
|
|
369
|
+
* @returns The common filter or a Promise
|
|
321
370
|
* that resolves to the common filter, or undefined if not available.
|
|
322
371
|
*/
|
|
323
372
|
protected _getNestedFilter(args: MongoService.CommandInfo): MongoAdapter.FilterInput | Promise<MongoAdapter.FilterInput> | undefined;
|