@opra/mongodb 0.33.13 → 1.0.0-alpha.2
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/cjs/adapter-utils/prepare-filter.js +20 -28
- package/cjs/adapter-utils/prepare-projection.js +40 -39
- package/cjs/index.js +1 -2
- package/cjs/mongo-adapter.js +66 -1
- package/cjs/mongo-collection-service.js +72 -313
- package/cjs/mongo-entity-service.js +329 -0
- package/cjs/{mongo-array-service.js → mongo-nested-service.js} +231 -225
- package/cjs/mongo-service.js +124 -183
- package/cjs/mongo-singleton-service.js +28 -124
- package/esm/adapter-utils/prepare-filter.js +20 -28
- package/esm/adapter-utils/prepare-projection.js +39 -38
- package/esm/index.js +1 -2
- package/esm/mongo-adapter.js +66 -1
- package/esm/mongo-collection-service.js +73 -313
- package/esm/mongo-entity-service.js +324 -0
- package/esm/mongo-nested-service.js +569 -0
- package/esm/mongo-service.js +125 -184
- package/esm/mongo-singleton-service.js +29 -125
- package/package.json +9 -8
- package/types/adapter-utils/prepare-filter.d.ts +2 -3
- package/types/adapter-utils/prepare-projection.d.ts +4 -13
- package/types/index.d.ts +1 -2
- package/types/mongo-adapter.d.ts +14 -1
- package/types/mongo-collection-service.d.ts +88 -251
- package/types/mongo-entity-service.d.ts +149 -0
- package/types/mongo-nested-service.d.ts +258 -0
- package/types/mongo-service.d.ts +208 -82
- package/types/mongo-singleton-service.d.ts +39 -148
- package/cjs/types.js +0 -2
- package/esm/mongo-array-service.js +0 -563
- package/esm/types.js +0 -1
- package/types/mongo-array-service.d.ts +0 -409
- package/types/types.d.ts +0 -3
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import mongodb from 'mongodb';
|
|
2
|
-
import { StrictOmit, Type } from 'ts-gems';
|
|
3
|
-
import * as OpraCommon from '@opra/common';
|
|
4
|
-
import { ComplexType, PartialDTO, PatchDTO } from '@opra/common';
|
|
5
|
-
import { FilterInput } from './adapter-utils/prepare-filter.js';
|
|
6
|
-
import { MongoService } from './mongo-service.js';
|
|
7
|
-
import { AnyId } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* A class that provides methods to perform operations on an array field in a MongoDB collection.
|
|
10
|
-
* @template T The type of the array item.
|
|
11
|
-
*/
|
|
12
|
-
export declare class MongoArrayService<T extends mongodb.Document> extends MongoService<T> {
|
|
13
|
-
/**
|
|
14
|
-
* Represents the key for a collection.
|
|
15
|
-
*
|
|
16
|
-
* @type {string}
|
|
17
|
-
*/
|
|
18
|
-
collectionKey: string;
|
|
19
|
-
/**
|
|
20
|
-
* Represents the name of the array field in parent document
|
|
21
|
-
*
|
|
22
|
-
* @type {string} FieldName
|
|
23
|
-
*/
|
|
24
|
-
fieldName: string;
|
|
25
|
-
/**
|
|
26
|
-
* Represents the key field of an array.
|
|
27
|
-
*
|
|
28
|
-
* @type {string} arrayKey
|
|
29
|
-
*/
|
|
30
|
-
arrayKey: string;
|
|
31
|
-
/**
|
|
32
|
-
* Represents the default limit value for a certain operation.
|
|
33
|
-
*
|
|
34
|
-
* @type {number}
|
|
35
|
-
*/
|
|
36
|
-
defaultLimit: number;
|
|
37
|
-
/**
|
|
38
|
-
* Represents a common document filter function for a MongoCollectionService.
|
|
39
|
-
*
|
|
40
|
-
* @type {FilterInput
|
|
41
|
-
*/
|
|
42
|
-
$documentFilter?: FilterInput | ((args: {
|
|
43
|
-
crud: MongoService.CrudOp;
|
|
44
|
-
method: string;
|
|
45
|
-
byId: boolean;
|
|
46
|
-
documentId?: AnyId;
|
|
47
|
-
itemId?: AnyId;
|
|
48
|
-
input?: Record<string, any>;
|
|
49
|
-
options?: Record<string, any>;
|
|
50
|
-
}, _this: this) => FilterInput | Promise<FilterInput> | undefined);
|
|
51
|
-
/**
|
|
52
|
-
* Represents a common array filter function for a MongoCollectionService.
|
|
53
|
-
*
|
|
54
|
-
* @type {FilterInput | Function}
|
|
55
|
-
*/
|
|
56
|
-
$arrayFilter?: FilterInput | ((args: {
|
|
57
|
-
crud: MongoService.CrudOp;
|
|
58
|
-
method: string;
|
|
59
|
-
byId: boolean;
|
|
60
|
-
documentId?: AnyId;
|
|
61
|
-
itemId?: AnyId;
|
|
62
|
-
input?: Record<string, any>;
|
|
63
|
-
options?: Record<string, any>;
|
|
64
|
-
}, _this: this) => FilterInput | Promise<FilterInput> | undefined);
|
|
65
|
-
/**
|
|
66
|
-
* Interceptor function for handling callback execution with provided arguments.
|
|
67
|
-
*
|
|
68
|
-
* @param callback - The callback function to be intercepted.
|
|
69
|
-
* @param args - The arguments object containing the following properties:
|
|
70
|
-
* @param crud - The CRUD operation type.
|
|
71
|
-
* @param method - The method name.
|
|
72
|
-
* @param byId - True if current operation affects byId records (updateMany, deleteMany etc)
|
|
73
|
-
* @param documentId - The document ID (optional).
|
|
74
|
-
* @param itemId - ID for an item. (optional).
|
|
75
|
-
* @param input - The input object (optional).
|
|
76
|
-
* @param options - Additional options (optional).
|
|
77
|
-
* @param _this - The reference to the current object.
|
|
78
|
-
* @returns - The promise that resolves to the result of the callback execution.
|
|
79
|
-
*/
|
|
80
|
-
$interceptor?: (callback: (...args: any[]) => any, args: {
|
|
81
|
-
crud: MongoService.CrudOp;
|
|
82
|
-
method: string;
|
|
83
|
-
documentId?: AnyId;
|
|
84
|
-
byId: boolean;
|
|
85
|
-
itemId?: AnyId;
|
|
86
|
-
input?: Record<string, any>;
|
|
87
|
-
options?: Record<string, any>;
|
|
88
|
-
}, _this: any) => Promise<any>;
|
|
89
|
-
/**
|
|
90
|
-
* Constructs a new instance
|
|
91
|
-
*
|
|
92
|
-
* @param {Type | string} dataType - The data type of the array elements.
|
|
93
|
-
* @param {string} fieldName - The name of the field in the document representing the array.
|
|
94
|
-
* @param {MongoArrayService.Options} [options] - The options for the array service.
|
|
95
|
-
* @constructor
|
|
96
|
-
*/
|
|
97
|
-
constructor(dataType: Type | string, fieldName: string, options?: MongoArrayService.Options);
|
|
98
|
-
/**
|
|
99
|
-
* Asserts whether a resource with the specified parentId and id exists.
|
|
100
|
-
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
101
|
-
*
|
|
102
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
103
|
-
* @param {AnyId} id - The ID of the resource.
|
|
104
|
-
* @param {MongoArrayService.ExistsOptions} [options] - Optional parameters for checking resource existence.
|
|
105
|
-
* @return {Promise<void>} - A promise that resolves with no value upon success.
|
|
106
|
-
* @throws {ResourceNotAvailableError} - If the resource does not exist.
|
|
107
|
-
*/
|
|
108
|
-
assert(documentId: AnyId, id: AnyId, options?: MongoArrayService.ExistsOptions): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Adds a single item into the array field.
|
|
111
|
-
*
|
|
112
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
113
|
-
* @param {T} input - The item to be added to the array field.
|
|
114
|
-
* @param {MongoArrayService.CreateOptions} [options] - Optional options for the create operation.
|
|
115
|
-
* @return {Promise<PartialDTO<T>>} - A promise that resolves with the partial output of the created item.
|
|
116
|
-
* @throws {ResourceNotAvailableError} - If the parent document is not found.
|
|
117
|
-
*/
|
|
118
|
-
create(documentId: AnyId, input: PartialDTO<T>, options?: MongoArrayService.CreateOptions): Promise<PartialDTO<T>>;
|
|
119
|
-
protected _create(documentId: AnyId, input: PartialDTO<T>, options?: MongoArrayService.CreateOptions): Promise<PartialDTO<T>>;
|
|
120
|
-
/**
|
|
121
|
-
* Counts the number of documents in the collection that match the specified parentId and options.
|
|
122
|
-
*
|
|
123
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
124
|
-
* @param {object} options - Optional parameters for counting.
|
|
125
|
-
* @param {object} options.filter - The filter object to apply to the count operation.
|
|
126
|
-
* @returns {Promise<number>} - A promise that resolves to the count of documents.
|
|
127
|
-
*/
|
|
128
|
-
count(documentId: AnyId, options?: MongoArrayService.CountOptions<T>): Promise<number>;
|
|
129
|
-
protected _count(documentId: AnyId, options?: MongoArrayService.CountOptions<T> & {
|
|
130
|
-
documentFilter?: FilterInput;
|
|
131
|
-
}): Promise<number>;
|
|
132
|
-
/**
|
|
133
|
-
* Deletes an element from an array within a document in the MongoDB collection.
|
|
134
|
-
*
|
|
135
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
136
|
-
* @param {AnyId} id - The ID of the element to delete from the array.
|
|
137
|
-
* @param {MongoArrayService.DeleteOptions<T>} [options] - Additional options for the delete operation.
|
|
138
|
-
* @return {Promise<number>} - A Promise that resolves to the number of elements deleted (1 if successful, 0 if not).
|
|
139
|
-
*/
|
|
140
|
-
delete(documentId: AnyId, id: AnyId, options?: MongoArrayService.DeleteOptions<T>): Promise<number>;
|
|
141
|
-
protected _delete(documentId: AnyId, id: AnyId, options?: MongoArrayService.DeleteOptions<T> & {
|
|
142
|
-
documentFilter?: FilterInput;
|
|
143
|
-
}): Promise<number>;
|
|
144
|
-
/**
|
|
145
|
-
* Deletes multiple items from a collection based on the parent ID and optional filter.
|
|
146
|
-
*
|
|
147
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
148
|
-
* @param {MongoArrayService.DeleteManyOptions<T>} options - Optional options to specify a filter.
|
|
149
|
-
* @returns {Promise<number>} - A Promise that resolves to the number of items deleted.
|
|
150
|
-
*/
|
|
151
|
-
deleteMany(documentId: AnyId, options?: MongoArrayService.DeleteManyOptions<T>): Promise<number>;
|
|
152
|
-
protected _deleteMany(documentId: AnyId, options?: MongoArrayService.DeleteManyOptions<T> & {
|
|
153
|
-
documentFilter?: FilterInput;
|
|
154
|
-
}): Promise<number>;
|
|
155
|
-
/**
|
|
156
|
-
* Checks if an array element with the given parentId and id exists.
|
|
157
|
-
*
|
|
158
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
159
|
-
* @param {AnyId} id - The id of the record.
|
|
160
|
-
* @param {MongoArrayService.ExistsOptions} [options] - The options for the exists method.
|
|
161
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating if the record exists or not.
|
|
162
|
-
*/
|
|
163
|
-
exists(documentId: AnyId, id: AnyId, options?: MongoArrayService.ExistsOptions): Promise<boolean>;
|
|
164
|
-
/**
|
|
165
|
-
* Finds an element in array field by its parent ID and ID.
|
|
166
|
-
*
|
|
167
|
-
* @param {AnyId} documentId - The ID of the document.
|
|
168
|
-
* @param {AnyId} id - The ID of the document.
|
|
169
|
-
* @param {MongoArrayService.FindOneOptions} [options] - The optional options for the operation.
|
|
170
|
-
* @returns {Promise<PartialDTO<T> | undefined>} - A promise that resolves to the found document or undefined if not found.
|
|
171
|
-
*/
|
|
172
|
-
findById(documentId: AnyId, id: AnyId, options?: MongoArrayService.FindOneOptions): Promise<PartialDTO<T> | undefined>;
|
|
173
|
-
protected _findById(documentId: AnyId, id: AnyId, options?: MongoArrayService.FindOneOptions & {
|
|
174
|
-
documentFilter?: FilterInput;
|
|
175
|
-
}): Promise<PartialDTO<T> | undefined>;
|
|
176
|
-
/**
|
|
177
|
-
* Finds the first array element that matches the given parentId.
|
|
178
|
-
*
|
|
179
|
-
* @param {AnyId} documentId - The ID of the document.
|
|
180
|
-
* @param {MongoArrayService.FindOneOptions} [options] - Optional options to customize the query.
|
|
181
|
-
* @returns {Promise<PartialDTO<T> | undefined>} A promise that resolves to the first matching document, or `undefined` if no match is found.
|
|
182
|
-
*/
|
|
183
|
-
findOne(documentId: AnyId, options?: MongoArrayService.FindOneOptions): Promise<PartialDTO<T> | undefined>;
|
|
184
|
-
protected _findOne(documentId: AnyId, options?: MongoArrayService.FindOneOptions & {
|
|
185
|
-
documentFilter?: FilterInput;
|
|
186
|
-
}): Promise<PartialDTO<T> | undefined>;
|
|
187
|
-
/**
|
|
188
|
-
* Finds multiple elements in an array field.
|
|
189
|
-
*
|
|
190
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
191
|
-
* @param {MongoArrayService.FindManyOptions<T>} [options] - The options for finding the documents.
|
|
192
|
-
* @returns {Promise<PartialDTO<T>[]>} - The found documents.
|
|
193
|
-
*/
|
|
194
|
-
findMany(documentId: AnyId, options?: MongoArrayService.FindManyOptions<T>): Promise<PartialDTO<T>[]>;
|
|
195
|
-
protected _findMany(documentId: AnyId, options: MongoArrayService.FindManyOptions<T> & {
|
|
196
|
-
documentFilter?: FilterInput;
|
|
197
|
-
arrayFilter?: FilterInput;
|
|
198
|
-
}): Promise<PartialDTO<T>[]>;
|
|
199
|
-
/**
|
|
200
|
-
* Retrieves a specific item from the array of a document.
|
|
201
|
-
*
|
|
202
|
-
* @param {AnyId} documentId - The ID of the document.
|
|
203
|
-
* @param {AnyId} id - The ID of the item.
|
|
204
|
-
* @param {MongoArrayService.FindOneOptions<T>} [options] - The options for finding the item.
|
|
205
|
-
* @returns {Promise<PartialDTO<T>>} - The item found.
|
|
206
|
-
* @throws {ResourceNotAvailableError} - If the item is not found.
|
|
207
|
-
*/
|
|
208
|
-
get(documentId: AnyId, id: AnyId, options?: MongoArrayService.FindOneOptions<T>): Promise<PartialDTO<T>>;
|
|
209
|
-
/**
|
|
210
|
-
* Updates an array element with new data and returns the updated element
|
|
211
|
-
*
|
|
212
|
-
* @param {AnyId} documentId - The ID of the document to update.
|
|
213
|
-
* @param {AnyId} id - The ID of the item to update within the document.
|
|
214
|
-
* @param {PatchDTO<T>} input - The new data to update the item with.
|
|
215
|
-
* @param {MongoArrayService.UpdateOptions<T>} [options] - Additional update options.
|
|
216
|
-
* @returns {Promise<PartialDTO<T> | undefined>} The updated item or undefined if it does not exist.
|
|
217
|
-
* @throws {Error} If an error occurs while updating the item.
|
|
218
|
-
*/
|
|
219
|
-
update(documentId: AnyId, id: AnyId, input: PatchDTO<T>, options?: MongoArrayService.UpdateOptions<T>): Promise<PartialDTO<T> | undefined>;
|
|
220
|
-
/**
|
|
221
|
-
* Update an array element with new data. Returns 1 if document updated 0 otherwise.
|
|
222
|
-
*
|
|
223
|
-
* @param {AnyId} documentId - The ID of the parent document.
|
|
224
|
-
* @param {AnyId} id - The ID of the document to update.
|
|
225
|
-
* @param {PatchDTO<T>} input - The partial input object containing the fields to update.
|
|
226
|
-
* @param {MongoArrayService.UpdateOptions<T>} [options] - Optional update options.
|
|
227
|
-
* @returns {Promise<number>} - A promise that resolves to the number of elements updated.
|
|
228
|
-
*/
|
|
229
|
-
updateOnly(documentId: AnyId, id: AnyId, input: PatchDTO<T>, options?: MongoArrayService.UpdateOptions<T>): Promise<number>;
|
|
230
|
-
protected _updateOnly(documentId: AnyId, id: AnyId, input: PatchDTO<T>, options?: MongoArrayService.UpdateOptions<T> & {
|
|
231
|
-
documentFilter?: FilterInput;
|
|
232
|
-
}): Promise<number>;
|
|
233
|
-
/**
|
|
234
|
-
* Updates multiple array elements in document
|
|
235
|
-
*
|
|
236
|
-
* @param {AnyId} documentId - The ID of the document to update.
|
|
237
|
-
* @param {PatchDTO<T>} input - The updated data for the document(s).
|
|
238
|
-
* @param {MongoArrayService.UpdateManyOptions<T>} [options] - Additional options for the update operation.
|
|
239
|
-
* @returns {Promise<number>} - A promise that resolves to the number of documents updated.
|
|
240
|
-
*/
|
|
241
|
-
updateMany(documentId: AnyId, input: PatchDTO<T>, options?: MongoArrayService.UpdateManyOptions<T>): Promise<number>;
|
|
242
|
-
protected _updateMany(documentId: AnyId, input: PatchDTO<T>, options?: MongoArrayService.UpdateManyOptions<T> & {
|
|
243
|
-
documentFilter?: FilterInput;
|
|
244
|
-
}): Promise<number>;
|
|
245
|
-
/**
|
|
246
|
-
* Retrieves the data type of the array field
|
|
247
|
-
*
|
|
248
|
-
* @returns {ComplexType} The complex data type of the field.
|
|
249
|
-
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
250
|
-
*/
|
|
251
|
-
getDataType(): ComplexType;
|
|
252
|
-
/**
|
|
253
|
-
* Generates an ID.
|
|
254
|
-
*
|
|
255
|
-
* @protected
|
|
256
|
-
* @returns {AnyId} The generated ID.
|
|
257
|
-
*/
|
|
258
|
-
protected _generateId(): AnyId;
|
|
259
|
-
/**
|
|
260
|
-
* Retrieves the common filter used for querying documents.
|
|
261
|
-
* This method is mostly used for security issues like securing multi-tenant applications.
|
|
262
|
-
*
|
|
263
|
-
* @protected
|
|
264
|
-
* @returns {FilterInput | Promise<FilterInput> | undefined} The common filter or a Promise
|
|
265
|
-
* that resolves to the common filter, or undefined if not available.
|
|
266
|
-
*/
|
|
267
|
-
protected _getDocumentFilter(args: {
|
|
268
|
-
crud: MongoService.CrudOp;
|
|
269
|
-
method: string;
|
|
270
|
-
byId: boolean;
|
|
271
|
-
documentId?: AnyId;
|
|
272
|
-
itemId?: AnyId;
|
|
273
|
-
input?: Object;
|
|
274
|
-
options?: Record<string, any>;
|
|
275
|
-
}): FilterInput | Promise<FilterInput> | undefined;
|
|
276
|
-
/**
|
|
277
|
-
* Retrieves the common filter used for querying array elements.
|
|
278
|
-
* This method is mostly used for security issues like securing multi-tenant applications.
|
|
279
|
-
*
|
|
280
|
-
* @protected
|
|
281
|
-
* @returns {FilterInput | Promise<FilterInput> | undefined} The common filter or a Promise
|
|
282
|
-
* that resolves to the common filter, or undefined if not available.
|
|
283
|
-
*/
|
|
284
|
-
protected _getArrayFilter(args: {
|
|
285
|
-
crud: MongoService.CrudOp;
|
|
286
|
-
method: string;
|
|
287
|
-
byId: boolean;
|
|
288
|
-
documentId?: AnyId;
|
|
289
|
-
itemId?: AnyId;
|
|
290
|
-
input?: Object;
|
|
291
|
-
options?: Record<string, any>;
|
|
292
|
-
}): FilterInput | Promise<FilterInput> | undefined;
|
|
293
|
-
protected _intercept(callback: (...args: any[]) => any, args: {
|
|
294
|
-
crud: MongoService.CrudOp;
|
|
295
|
-
method: string;
|
|
296
|
-
byId: boolean;
|
|
297
|
-
documentId?: AnyId;
|
|
298
|
-
itemId?: AnyId;
|
|
299
|
-
input?: Object;
|
|
300
|
-
options?: Record<string, any>;
|
|
301
|
-
}): Promise<any>;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
*
|
|
305
|
-
* @namespace MongoArrayService
|
|
306
|
-
*/
|
|
307
|
-
export declare namespace MongoArrayService {
|
|
308
|
-
/**
|
|
309
|
-
* The constructor options of MongoArrayService.
|
|
310
|
-
*/
|
|
311
|
-
interface Options extends MongoService.Options {
|
|
312
|
-
collectionKey?: MongoArrayService<any>['collectionKey'];
|
|
313
|
-
defaultLimit?: MongoArrayService<any>['defaultLimit'];
|
|
314
|
-
arrayKey?: MongoArrayService<any>['arrayKey'];
|
|
315
|
-
documentFilter?: MongoArrayService<any>['$documentFilter'];
|
|
316
|
-
arrayFilter?: MongoArrayService<any>['$arrayFilter'];
|
|
317
|
-
interceptor?: MongoArrayService<any>['$interceptor'];
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Represents options for creating objects.
|
|
321
|
-
*
|
|
322
|
-
* @interface
|
|
323
|
-
*/
|
|
324
|
-
interface CreateOptions extends mongodb.UpdateOptions {
|
|
325
|
-
pick?: string[];
|
|
326
|
-
omit?: string[];
|
|
327
|
-
include?: string[];
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Represents options for counting a new object.
|
|
331
|
-
*
|
|
332
|
-
* @interface
|
|
333
|
-
* @template T - The type of the document.
|
|
334
|
-
*/
|
|
335
|
-
interface CountOptions<T> extends mongodb.AggregateOptions {
|
|
336
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Represents options for deleting single object.
|
|
340
|
-
*
|
|
341
|
-
* @interface
|
|
342
|
-
* @template T - The type of the document.
|
|
343
|
-
*/
|
|
344
|
-
interface DeleteOptions<T> extends mongodb.UpdateOptions {
|
|
345
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Represents options for deleting multiple objects.
|
|
349
|
-
*
|
|
350
|
-
* @interface
|
|
351
|
-
* @template T - The type of the document.
|
|
352
|
-
*/
|
|
353
|
-
interface DeleteManyOptions<T> extends mongodb.UpdateOptions {
|
|
354
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Represents options for finding single object.
|
|
358
|
-
*
|
|
359
|
-
* @interface
|
|
360
|
-
* @template T - The type of the document.
|
|
361
|
-
*/
|
|
362
|
-
interface FindOneOptions<T = any> extends StrictOmit<FindManyOptions<T>, 'count' | 'limit'> {
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Represents options for finding multiple objects.
|
|
366
|
-
*
|
|
367
|
-
* @interface
|
|
368
|
-
* @template T - The type of the document.
|
|
369
|
-
*/
|
|
370
|
-
interface FindManyOptions<T> extends mongodb.AggregateOptions {
|
|
371
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
372
|
-
pick?: string[];
|
|
373
|
-
omit?: string[];
|
|
374
|
-
include?: string[];
|
|
375
|
-
sort?: string[];
|
|
376
|
-
count?: boolean;
|
|
377
|
-
limit?: number;
|
|
378
|
-
skip?: number;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Represents options for updating single object.
|
|
382
|
-
*
|
|
383
|
-
* @interface
|
|
384
|
-
* @template T - The type of the document.
|
|
385
|
-
*/
|
|
386
|
-
interface UpdateOptions<T> extends mongodb.UpdateOptions {
|
|
387
|
-
pick?: string[];
|
|
388
|
-
omit?: string[];
|
|
389
|
-
include?: string[];
|
|
390
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Represents options for updating multiple objects.
|
|
394
|
-
*
|
|
395
|
-
* @interface
|
|
396
|
-
* @template T - The type of the document.
|
|
397
|
-
*/
|
|
398
|
-
interface UpdateManyOptions<T> extends mongodb.UpdateOptions {
|
|
399
|
-
filter?: mongodb.Filter<T> | OpraCommon.OpraFilter.Ast | string;
|
|
400
|
-
count?: boolean;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Represents options for checking the document exists
|
|
404
|
-
*
|
|
405
|
-
* @interface
|
|
406
|
-
*/
|
|
407
|
-
interface ExistsOptions extends Omit<mongodb.CommandOperationOptions, 'writeConcern'> {
|
|
408
|
-
}
|
|
409
|
-
}
|
package/types/types.d.ts
DELETED