@kikiutils/mongoose 2.0.0-rc.0 → 2.0.0
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 +10 -12
- package/constants.cjs +6 -12
- package/constants.d.ts +6 -338
- package/constants.mjs +6 -11
- package/options.cjs +9 -3
- package/options.d.ts +0 -4
- package/options.mjs +9 -3
- package/package.json +2 -2
- package/schema-builders/boolean.d.ts +1 -2
- package/schema-builders/date.d.ts +1 -2
- package/schema-builders/decimal128.d.ts +2 -1
- package/schema-builders/number.d.ts +1 -2
- package/schema-builders/object-id.d.ts +1 -2
- package/schema-builders/ref.d.ts +1 -2
- package/schema-builders/string.d.ts +4 -1
- package/utils.cjs +7 -309
- package/utils.d.ts +1 -413
- package/utils.mjs +5 -300
- package/_connections.cjs +0 -12
- package/_connections.d.ts +0 -9
- package/_connections.mjs +0 -10
- package/types/schema.d.ts +0 -142
- /package/{_options.cjs → _internals.cjs} +0 -0
- /package/{_options.d.ts → _internals.d.ts} +0 -0
- /package/{_options.mjs → _internals.mjs} +0 -0
package/utils.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { setCustomMongooseOptions } from './options';
|
|
3
|
-
import type { schemaBuilders } from './schema-builders';
|
|
4
3
|
import type { BuildMongooseModelOptions } from './types/options';
|
|
5
|
-
|
|
6
|
-
export type DoNotUseOrRemoveThisType = typeof schemaBuilders | typeof setCustomMongooseOptions;
|
|
4
|
+
export type DoNotUseOrRemoveThisType = typeof setCustomMongooseOptions;
|
|
7
5
|
/**
|
|
8
6
|
* Builds and returns a Mongoose model with specified schema and options.
|
|
9
7
|
*
|
|
@@ -32,399 +30,6 @@ export type DoNotUseOrRemoveThisType = typeof schemaBuilders | typeof setCustomM
|
|
|
32
30
|
* @returns The created Mongoose model.
|
|
33
31
|
*/
|
|
34
32
|
export declare function buildMongooseModel<DocType, Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>, InstanceMethodsAndOverrides = {}, QueryHelpers = {}>(collection: string, name: string, schema: mongoose.Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>, options?: BuildMongooseModelOptions): Model;
|
|
35
|
-
/**
|
|
36
|
-
* Creates common Mongoose schema definitions with optional custom schemas and settings.
|
|
37
|
-
*
|
|
38
|
-
* This function generates a set of commonly used schema definitions, such as boolean,
|
|
39
|
-
* number, objectId, and string schemas, with optional custom configurations and rounding
|
|
40
|
-
* options for Decimal128 fields.
|
|
41
|
-
*
|
|
42
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders} instead.
|
|
43
|
-
*
|
|
44
|
-
* @template T - The type for custom schemas.
|
|
45
|
-
*
|
|
46
|
-
* @param customSchemas - Optional custom schemas to merge with the common schemas.
|
|
47
|
-
* @param options - Optional settings for creating the common schemas.
|
|
48
|
-
*
|
|
49
|
-
* @returns The merged common and custom schemas.
|
|
50
|
-
*/
|
|
51
|
-
export declare function createCommonMongooseSchemas<T extends {}>(customSchemas?: T, options?: CreateCommonMongooseSchemasOptions): {
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.boolean} instead.
|
|
54
|
-
*/
|
|
55
|
-
readonly boolean: {
|
|
56
|
-
readonly defaultFalse: {
|
|
57
|
-
readonly nonRequired: {
|
|
58
|
-
readonly default: false;
|
|
59
|
-
readonly type: BooleanConstructor;
|
|
60
|
-
};
|
|
61
|
-
readonly required: {
|
|
62
|
-
readonly default: false;
|
|
63
|
-
readonly required: true;
|
|
64
|
-
readonly type: BooleanConstructor;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
readonly defaultTrue: {
|
|
68
|
-
readonly nonRequired: {
|
|
69
|
-
readonly default: true;
|
|
70
|
-
readonly type: BooleanConstructor;
|
|
71
|
-
};
|
|
72
|
-
readonly required: {
|
|
73
|
-
readonly default: true;
|
|
74
|
-
readonly required: true;
|
|
75
|
-
readonly type: BooleanConstructor;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
readonly nonRequired: {
|
|
79
|
-
readonly type: BooleanConstructor;
|
|
80
|
-
};
|
|
81
|
-
readonly required: {
|
|
82
|
-
readonly required: true;
|
|
83
|
-
readonly type: BooleanConstructor;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.decimal128} instead.
|
|
88
|
-
*/
|
|
89
|
-
readonly decimal128: {
|
|
90
|
-
readonly autoRoundAndToFixed: {
|
|
91
|
-
readonly nonRequired: {
|
|
92
|
-
readonly set: (value: number | string | {
|
|
93
|
-
toString(): string;
|
|
94
|
-
}) => string;
|
|
95
|
-
readonly type: typeof mongoose.Schema.Types.Decimal128;
|
|
96
|
-
};
|
|
97
|
-
readonly required: {
|
|
98
|
-
readonly required: true;
|
|
99
|
-
readonly set: (value: number | string | {
|
|
100
|
-
toString(): string;
|
|
101
|
-
}) => string;
|
|
102
|
-
readonly type: typeof mongoose.Schema.Types.Decimal128;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
readonly nonRequired: {
|
|
106
|
-
readonly type: typeof mongoose.Schema.Types.Decimal128;
|
|
107
|
-
};
|
|
108
|
-
readonly required: {
|
|
109
|
-
readonly required: true;
|
|
110
|
-
readonly type: typeof mongoose.Schema.Types.Decimal128;
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.number} instead.
|
|
115
|
-
*/
|
|
116
|
-
readonly number: {
|
|
117
|
-
readonly nonRequired: {
|
|
118
|
-
readonly type: NumberConstructor;
|
|
119
|
-
};
|
|
120
|
-
readonly required: {
|
|
121
|
-
readonly required: true;
|
|
122
|
-
readonly type: NumberConstructor;
|
|
123
|
-
};
|
|
124
|
-
readonly unique: {
|
|
125
|
-
readonly nonRequired: {
|
|
126
|
-
readonly type: NumberConstructor;
|
|
127
|
-
readonly unique: true;
|
|
128
|
-
};
|
|
129
|
-
readonly required: {
|
|
130
|
-
readonly unique: true;
|
|
131
|
-
readonly required: true;
|
|
132
|
-
readonly type: NumberConstructor;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.objectId} instead.
|
|
138
|
-
*/
|
|
139
|
-
readonly objectId: {
|
|
140
|
-
readonly nonRequired: {
|
|
141
|
-
readonly type: typeof mongoose.Schema.Types.ObjectId;
|
|
142
|
-
};
|
|
143
|
-
readonly required: {
|
|
144
|
-
readonly required: true;
|
|
145
|
-
readonly type: typeof mongoose.Schema.Types.ObjectId;
|
|
146
|
-
};
|
|
147
|
-
readonly unique: {
|
|
148
|
-
readonly nonRequired: {
|
|
149
|
-
readonly type: typeof mongoose.Schema.Types.ObjectId;
|
|
150
|
-
readonly unique: true;
|
|
151
|
-
};
|
|
152
|
-
readonly required: {
|
|
153
|
-
readonly unique: true;
|
|
154
|
-
readonly required: true;
|
|
155
|
-
readonly type: typeof mongoose.Schema.Types.ObjectId;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.string} instead.
|
|
161
|
-
*/
|
|
162
|
-
readonly string: {
|
|
163
|
-
readonly ipv4: {
|
|
164
|
-
readonly nonRequired: {
|
|
165
|
-
readonly trim: true;
|
|
166
|
-
readonly type: StringConstructor;
|
|
167
|
-
readonly validate: {
|
|
168
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
169
|
-
readonly validator: (value: string) => boolean;
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
readonly private: {
|
|
173
|
-
readonly nonRequired: {
|
|
174
|
-
readonly private: true;
|
|
175
|
-
readonly trim: true;
|
|
176
|
-
readonly type: StringConstructor;
|
|
177
|
-
readonly validate: {
|
|
178
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
179
|
-
readonly validator: (value: string) => boolean;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
readonly required: {
|
|
183
|
-
readonly private: true;
|
|
184
|
-
readonly required: true;
|
|
185
|
-
readonly trim: true;
|
|
186
|
-
readonly type: StringConstructor;
|
|
187
|
-
readonly validate: {
|
|
188
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
189
|
-
readonly validator: (value: string) => boolean;
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
readonly unique: {
|
|
193
|
-
readonly nonRequired: {
|
|
194
|
-
readonly private: true;
|
|
195
|
-
readonly unique: true;
|
|
196
|
-
readonly trim: true;
|
|
197
|
-
readonly type: StringConstructor;
|
|
198
|
-
readonly validate: {
|
|
199
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
200
|
-
readonly validator: (value: string) => boolean;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
readonly required: {
|
|
204
|
-
readonly private: true;
|
|
205
|
-
readonly required: true;
|
|
206
|
-
readonly unique: true;
|
|
207
|
-
readonly trim: true;
|
|
208
|
-
readonly type: StringConstructor;
|
|
209
|
-
readonly validate: {
|
|
210
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
211
|
-
readonly validator: (value: string) => boolean;
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
readonly required: {
|
|
217
|
-
readonly required: true;
|
|
218
|
-
readonly trim: true;
|
|
219
|
-
readonly type: StringConstructor;
|
|
220
|
-
readonly validate: {
|
|
221
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
222
|
-
readonly validator: (value: string) => boolean;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
readonly unique: {
|
|
226
|
-
readonly nonRequired: {
|
|
227
|
-
readonly unique: true;
|
|
228
|
-
readonly trim: true;
|
|
229
|
-
readonly type: StringConstructor;
|
|
230
|
-
readonly validate: {
|
|
231
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
232
|
-
readonly validator: (value: string) => boolean;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
readonly required: {
|
|
236
|
-
readonly required: true;
|
|
237
|
-
readonly unique: true;
|
|
238
|
-
readonly trim: true;
|
|
239
|
-
readonly type: StringConstructor;
|
|
240
|
-
readonly validate: {
|
|
241
|
-
readonly message: "`{VALUE}` is not a valid IPv4 address for path `{PATH}`.";
|
|
242
|
-
readonly validator: (value: string) => boolean;
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
readonly ipv6: {
|
|
248
|
-
readonly nonRequired: {
|
|
249
|
-
readonly validate: {
|
|
250
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
251
|
-
readonly validator: (value: string) => boolean;
|
|
252
|
-
};
|
|
253
|
-
readonly trim: true;
|
|
254
|
-
readonly type: StringConstructor;
|
|
255
|
-
};
|
|
256
|
-
readonly private: {
|
|
257
|
-
readonly nonRequired: {
|
|
258
|
-
readonly private: true;
|
|
259
|
-
readonly validate: {
|
|
260
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
261
|
-
readonly validator: (value: string) => boolean;
|
|
262
|
-
};
|
|
263
|
-
readonly trim: true;
|
|
264
|
-
readonly type: StringConstructor;
|
|
265
|
-
};
|
|
266
|
-
readonly required: {
|
|
267
|
-
readonly private: true;
|
|
268
|
-
readonly required: true;
|
|
269
|
-
readonly validate: {
|
|
270
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
271
|
-
readonly validator: (value: string) => boolean;
|
|
272
|
-
};
|
|
273
|
-
readonly trim: true;
|
|
274
|
-
readonly type: StringConstructor;
|
|
275
|
-
};
|
|
276
|
-
readonly unique: {
|
|
277
|
-
readonly nonRequired: {
|
|
278
|
-
readonly private: true;
|
|
279
|
-
readonly unique: true;
|
|
280
|
-
readonly validate: {
|
|
281
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
282
|
-
readonly validator: (value: string) => boolean;
|
|
283
|
-
};
|
|
284
|
-
readonly trim: true;
|
|
285
|
-
readonly type: StringConstructor;
|
|
286
|
-
};
|
|
287
|
-
readonly required: {
|
|
288
|
-
readonly private: true;
|
|
289
|
-
readonly required: true;
|
|
290
|
-
readonly unique: true;
|
|
291
|
-
readonly validate: {
|
|
292
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
293
|
-
readonly validator: (value: string) => boolean;
|
|
294
|
-
};
|
|
295
|
-
readonly trim: true;
|
|
296
|
-
readonly type: StringConstructor;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
readonly required: {
|
|
301
|
-
readonly required: true;
|
|
302
|
-
readonly validate: {
|
|
303
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
304
|
-
readonly validator: (value: string) => boolean;
|
|
305
|
-
};
|
|
306
|
-
readonly trim: true;
|
|
307
|
-
readonly type: StringConstructor;
|
|
308
|
-
};
|
|
309
|
-
readonly unique: {
|
|
310
|
-
readonly nonRequired: {
|
|
311
|
-
readonly unique: true;
|
|
312
|
-
readonly validate: {
|
|
313
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
314
|
-
readonly validator: (value: string) => boolean;
|
|
315
|
-
};
|
|
316
|
-
readonly trim: true;
|
|
317
|
-
readonly type: StringConstructor;
|
|
318
|
-
};
|
|
319
|
-
readonly required: {
|
|
320
|
-
readonly required: true;
|
|
321
|
-
readonly unique: true;
|
|
322
|
-
readonly validate: {
|
|
323
|
-
readonly message: "`{VALUE}` is not a valid IPv6 address for path `{PATH}`.";
|
|
324
|
-
readonly validator: (value: string) => boolean;
|
|
325
|
-
};
|
|
326
|
-
readonly trim: true;
|
|
327
|
-
readonly type: StringConstructor;
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
};
|
|
331
|
-
readonly nonRequired: MongooseStringSchema<[]>;
|
|
332
|
-
readonly private: {
|
|
333
|
-
readonly nonRequired: MongooseStringSchema<["private"]>;
|
|
334
|
-
readonly required: MongooseStringSchema<["private", "required"]>;
|
|
335
|
-
readonly short: {
|
|
336
|
-
readonly nonRequired: MongooseStringSchema<["private", "short"]>;
|
|
337
|
-
readonly required: MongooseStringSchema<["private", "required", "short"]>;
|
|
338
|
-
readonly trimmed: {
|
|
339
|
-
readonly nonRequired: MongooseStringSchema<["private", "short", "trim"]>;
|
|
340
|
-
readonly required: MongooseStringSchema<["private", "required", "short", "trim"]>;
|
|
341
|
-
readonly unique: {
|
|
342
|
-
readonly nonRequired: MongooseStringSchema<["private", "short", "trim", "unique"]>;
|
|
343
|
-
readonly required: MongooseStringSchema<["private", "required", "short", "trim", "unique"]>;
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
readonly unique: {
|
|
347
|
-
readonly nonRequired: MongooseStringSchema<["private", "short", "unique"]>;
|
|
348
|
-
readonly required: MongooseStringSchema<["private", "required", "short", "unique"]>;
|
|
349
|
-
};
|
|
350
|
-
};
|
|
351
|
-
readonly trimmed: {
|
|
352
|
-
readonly nonRequired: MongooseStringSchema<["private", "trim"]>;
|
|
353
|
-
readonly required: MongooseStringSchema<["private", "required", "trim"]>;
|
|
354
|
-
readonly unique: {
|
|
355
|
-
readonly nonRequired: MongooseStringSchema<["private", "trim", "unique"]>;
|
|
356
|
-
readonly required: MongooseStringSchema<["private", "required", "trim", "unique"]>;
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
readonly unique: {
|
|
360
|
-
readonly nonRequired: MongooseStringSchema<["private", "unique"]>;
|
|
361
|
-
readonly required: MongooseStringSchema<["private", "required", "unique"]>;
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
readonly required: MongooseStringSchema<["required"]>;
|
|
365
|
-
readonly short: {
|
|
366
|
-
readonly nonRequired: MongooseStringSchema<["short"]>;
|
|
367
|
-
readonly required: MongooseStringSchema<["required", "short"]>;
|
|
368
|
-
readonly trimmed: {
|
|
369
|
-
readonly nonRequired: MongooseStringSchema<["short", "trim"]>;
|
|
370
|
-
readonly required: MongooseStringSchema<["required", "short", "trim"]>;
|
|
371
|
-
readonly unique: {
|
|
372
|
-
readonly nonRequired: MongooseStringSchema<["short", "trim", "unique"]>;
|
|
373
|
-
readonly required: MongooseStringSchema<["required", "short", "trim", "unique"]>;
|
|
374
|
-
};
|
|
375
|
-
};
|
|
376
|
-
readonly unique: {
|
|
377
|
-
readonly nonRequired: MongooseStringSchema<["short", "unique"]>;
|
|
378
|
-
readonly required: MongooseStringSchema<["required", "short", "unique"]>;
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
readonly trimmed: {
|
|
382
|
-
readonly nonRequired: MongooseStringSchema<["trim"]>;
|
|
383
|
-
readonly required: MongooseStringSchema<["required", "trim"]>;
|
|
384
|
-
readonly unique: {
|
|
385
|
-
readonly nonRequired: MongooseStringSchema<["trim", "unique"]>;
|
|
386
|
-
readonly required: MongooseStringSchema<["required", "trim", "unique"]>;
|
|
387
|
-
};
|
|
388
|
-
};
|
|
389
|
-
readonly unique: {
|
|
390
|
-
readonly nonRequired: MongooseStringSchema<["unique"]>;
|
|
391
|
-
readonly required: MongooseStringSchema<["required", "unique"]>;
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
} & T;
|
|
395
|
-
/**
|
|
396
|
-
* Creates a Mongoose schema definition for an ObjectId reference with specified attributes.
|
|
397
|
-
*
|
|
398
|
-
* This function generates a schema definition for an ObjectId reference field, including
|
|
399
|
-
* attributes such as 'private', 'required', and 'unique'.
|
|
400
|
-
*
|
|
401
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.ref} instead.
|
|
402
|
-
*
|
|
403
|
-
* @template R - The type of the reference model name.
|
|
404
|
-
* @template T - An array of attributes to apply to the schema field.
|
|
405
|
-
*
|
|
406
|
-
* @param refModelName - The name of the reference model.
|
|
407
|
-
* @param attributes - The attributes to apply to the schema field.
|
|
408
|
-
*
|
|
409
|
-
* @returns The generated ObjectId reference schema definition.
|
|
410
|
-
*/
|
|
411
|
-
export declare function createMongooseObjectIdRefSchema<R extends string, T extends BaseSchemaAttribute[]>(refModelName: R, ...attributes: T): MongooseObjectIdRefSchema<R, T>;
|
|
412
|
-
/**
|
|
413
|
-
* Creates a Mongoose schema definition for a string field with specified attributes.
|
|
414
|
-
*
|
|
415
|
-
* This function generates a schema definition for a string field, including attributes
|
|
416
|
-
* such as 'private', 'required', 'short', 'trim', and 'unique'. If the 'short' attribute
|
|
417
|
-
* is included, the `maxlength` is set to 16.
|
|
418
|
-
*
|
|
419
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.string} instead.
|
|
420
|
-
*
|
|
421
|
-
* @template T - An array of attributes to apply to the schema field.
|
|
422
|
-
*
|
|
423
|
-
* @param attributes - The attributes to apply to the schema field.
|
|
424
|
-
*
|
|
425
|
-
* @returns The generated string schema definition.
|
|
426
|
-
*/
|
|
427
|
-
export declare function createMongooseStringSchema<T extends MongooseStringSchemaAttribute[]>(...attributes: T): MongooseStringSchema<T>;
|
|
428
33
|
/**
|
|
429
34
|
* Converts a document or ObjectId to a document using the specified model.
|
|
430
35
|
*
|
|
@@ -443,20 +48,3 @@ export declare function createMongooseStringSchema<T extends MongooseStringSchem
|
|
|
443
48
|
* @returns The corresponding document or null if not found.
|
|
444
49
|
*/
|
|
445
50
|
export declare function mongooseDocumentOrObjectIdToDocument<D extends MongooseHydratedDocument<DocType, InstanceMethodsAndOverrides, QueryHelpers>, DocType, InstanceMethodsAndOverrides, QueryHelpers>(documentOrObjectId: MongooseDocumentOrObjectId<D>, model: BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>, selectFields?: string[]): Promise<D | null>;
|
|
446
|
-
/**
|
|
447
|
-
* Sets up a getter to convert Decimal128 fields to strings in a Mongoose schema.
|
|
448
|
-
*
|
|
449
|
-
* This function adds a getter to the specified Decimal128 fields in the schema,
|
|
450
|
-
* converting the values to strings for easier use.
|
|
451
|
-
*
|
|
452
|
-
* @deprecated - Will be removed in the next major version. Use {@link schemaBuilders.decimal128} instead.
|
|
453
|
-
*
|
|
454
|
-
* @template DocType - The type of the document.
|
|
455
|
-
* @template Model - The type of the model, which extends `BaseMongoosePaginateModel`.
|
|
456
|
-
* @template InstanceMethodsAndOverrides - The type for instance methods and overrides.
|
|
457
|
-
* @template QueryHelpers - The type for additional query helpers.
|
|
458
|
-
*
|
|
459
|
-
* @param schema - The Mongoose schema to modify.
|
|
460
|
-
* @param fields - The Decimal128 fields to add the getter to.
|
|
461
|
-
*/
|
|
462
|
-
export declare function setupDecimal128FieldsToStringGetter<DocType, Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>, InstanceMethodsAndOverrides = {}, QueryHelpers = {}>(schema: mongoose.Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>, ...fields: string[]): void;
|