1 | declare module 'mongoose' {
|
2 | import mongodb = require('mongodb');
|
3 |
|
4 | export interface AcceptsDiscriminator {
|
5 |
|
6 | discriminator<D>(name: string | number, schema: Schema, value?: string | number | ObjectId): Model<D>;
|
7 | discriminator<T, U>(name: string | number, schema: Schema<T, U>, value?: string | number | ObjectId): U;
|
8 | }
|
9 |
|
10 | interface MongooseBulkWriteOptions {
|
11 | skipValidation?: boolean;
|
12 | }
|
13 |
|
14 | interface InsertManyOptions extends
|
15 | PopulateOption,
|
16 | SessionOption {
|
17 | limit?: number;
|
18 | rawResult?: boolean;
|
19 | ordered?: boolean;
|
20 | lean?: boolean;
|
21 | }
|
22 |
|
23 | type InsertManyResult<T> = mongodb.InsertManyResult<T> & {
|
24 | insertedIds: {
|
25 | [key: number]: InferId<T>;
|
26 | };
|
27 | mongoose?: { validationErrors?: Array<Error.CastError | Error.ValidatorError> };
|
28 | };
|
29 |
|
30 | type UpdateWriteOpResult = mongodb.UpdateResult;
|
31 |
|
32 | interface MapReduceOptions<T, K, R> {
|
33 | map: Function | string;
|
34 | reduce: (key: K, vals: T[]) => R;
|
35 |
|
36 | query?: any;
|
37 |
|
38 | sort?: any;
|
39 |
|
40 | limit?: number;
|
41 |
|
42 | keeptemp?: boolean;
|
43 |
|
44 | finalize?: (key: K, val: R) => R;
|
45 |
|
46 | scope?: any;
|
47 |
|
48 | jsMode?: boolean;
|
49 |
|
50 | verbose?: boolean;
|
51 | readPreference?: string;
|
52 |
|
53 | out?: {
|
54 |
|
55 | inline?: number;
|
56 | |
57 |
|
58 |
|
59 |
|
60 | replace?: string;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | reduce?: string;
|
66 | |
67 |
|
68 |
|
69 |
|
70 | merge?: string;
|
71 | };
|
72 | }
|
73 |
|
74 | interface GeoSearchOptions {
|
75 |
|
76 | near: number[];
|
77 |
|
78 | maxDistance: number;
|
79 |
|
80 | limit?: number;
|
81 |
|
82 | lean?: boolean;
|
83 | }
|
84 |
|
85 | interface ModifyResult<T> {
|
86 | value: Require_id<T> | null;
|
87 |
|
88 | lastErrorObject?: {
|
89 | updatedExisting?: boolean;
|
90 | upserted?: mongodb.ObjectId;
|
91 | };
|
92 | ok: 0 | 1;
|
93 | }
|
94 |
|
95 | type WriteConcern = mongodb.WriteConcern;
|
96 |
|
97 |
|
98 | type PathsToValidate = string[] | string;
|
99 | |
100 |
|
101 |
|
102 | type pathsToValidate = PathsToValidate;
|
103 |
|
104 | interface SaveOptions extends
|
105 | SessionOption {
|
106 | checkKeys?: boolean;
|
107 | j?: boolean;
|
108 | safe?: boolean | WriteConcern;
|
109 | timestamps?: boolean | QueryTimestampsConfig;
|
110 | validateBeforeSave?: boolean;
|
111 | validateModifiedOnly?: boolean;
|
112 | w?: number | string;
|
113 | wtimeout?: number;
|
114 | }
|
115 |
|
116 | interface RemoveOptions extends SessionOption, Omit<mongodb.DeleteOptions, 'session'> {}
|
117 |
|
118 | const Model: Model<any>;
|
119 | interface Model<T, TQueryHelpers = {}, TMethodsAndOverrides = {}, TVirtuals = {}, TSchema = any> extends
|
120 | NodeJS.EventEmitter,
|
121 | AcceptsDiscriminator,
|
122 | IndexManager,
|
123 | SessionStarter {
|
124 | new <DocType = T>(doc?: DocType, fields?: any | null, options?: boolean | AnyObject): HydratedDocument<T, TMethodsAndOverrides,
|
125 | IfEquals<TVirtuals, {}, ObtainSchemaGeneric<TSchema, 'TVirtuals'>, TVirtuals>> & ObtainSchemaGeneric<TSchema, 'TStaticMethods'>;
|
126 |
|
127 | aggregate<R = any>(pipeline?: PipelineStage[], options?: mongodb.AggregateOptions, callback?: Callback<R[]>): Aggregate<Array<R>>;
|
128 | aggregate<R = any>(pipeline: PipelineStage[], callback?: Callback<R[]>): Aggregate<Array<R>>;
|
129 |
|
130 |
|
131 | base: Mongoose;
|
132 |
|
133 | |
134 |
|
135 |
|
136 |
|
137 | baseModelName: string | undefined;
|
138 |
|
139 |
|
140 | castObject(obj: AnyObject, options?: { ignoreCastErrors?: boolean }): T;
|
141 |
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | bulkWrite(writes: Array<mongodb.AnyBulkWriteOperation<T extends {} ? T : any>>, options: mongodb.BulkWriteOptions & MongooseBulkWriteOptions, callback: Callback<mongodb.BulkWriteResult>): void;
|
150 | bulkWrite(writes: Array<mongodb.AnyBulkWriteOperation<T extends {} ? T : any>>, callback: Callback<mongodb.BulkWriteResult>): void;
|
151 | bulkWrite(writes: Array<mongodb.AnyBulkWriteOperation<T extends {} ? T : any>>, options?: mongodb.BulkWriteOptions & MongooseBulkWriteOptions): Promise<mongodb.BulkWriteResult>;
|
152 |
|
153 | |
154 |
|
155 |
|
156 |
|
157 |
|
158 | bulkSave(documents: Array<Document>, options?: mongodb.BulkWriteOptions & { timestamps?: boolean }): Promise<mongodb.BulkWriteResult>;
|
159 |
|
160 |
|
161 | collection: Collection;
|
162 |
|
163 |
|
164 | count(callback?: Callback<number>): QueryWithHelpers<number, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
165 | count(filter: FilterQuery<T>, callback?: Callback<number>): QueryWithHelpers<number, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
166 |
|
167 |
|
168 | countDocuments(filter: FilterQuery<T>, options?: QueryOptions<T>, callback?: Callback<number>): QueryWithHelpers<number, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
169 | countDocuments(callback?: Callback<number>): QueryWithHelpers<number, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
170 |
|
171 |
|
172 | create<DocContents = AnyKeys<T>>(docs: Array<T | DocContents>, options?: SaveOptions): Promise<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>[]>;
|
173 | create<DocContents = AnyKeys<T>>(docs: Array<T | DocContents>, callback: Callback<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>[]>): void;
|
174 | create<DocContents = AnyKeys<T>>(doc: DocContents | T): Promise<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>;
|
175 | create<DocContents = AnyKeys<T>>(...docs: Array<T | DocContents>): Promise<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>[]>;
|
176 | create<DocContents = AnyKeys<T>>(doc: T | DocContents, callback: Callback<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>): void;
|
177 |
|
178 | |
179 |
|
180 |
|
181 |
|
182 |
|
183 | createCollection<T extends mongodb.Document>(options: mongodb.CreateCollectionOptions & Pick<SchemaOptions, 'expires'> | null, callback: Callback<mongodb.Collection<T>>): void;
|
184 | createCollection<T extends mongodb.Document>(callback: Callback<mongodb.Collection<T>>): void;
|
185 | createCollection<T extends mongodb.Document>(options?: mongodb.CreateCollectionOptions & Pick<SchemaOptions, 'expires'>): Promise<mongodb.Collection<T>>;
|
186 |
|
187 |
|
188 | db: Connection;
|
189 |
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 | deleteMany(filter?: FilterQuery<T>, options?: QueryOptions<T>, callback?: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
196 | deleteMany(filter: FilterQuery<T>, callback: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
197 | deleteMany(callback: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
198 |
|
199 | |
200 |
|
201 |
|
202 |
|
203 |
|
204 | deleteOne(filter?: FilterQuery<T>, options?: QueryOptions<T>, callback?: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
205 | deleteOne(filter: FilterQuery<T>, callback: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
206 | deleteOne(callback: CallbackWithoutResult): QueryWithHelpers<mongodb.DeleteResult, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
207 |
|
208 | |
209 |
|
210 |
|
211 |
|
212 | events: NodeJS.EventEmitter;
|
213 |
|
214 | |
215 |
|
216 |
|
217 |
|
218 |
|
219 | findById<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
220 | id: any,
|
221 | projection?: ProjectionType<T> | null,
|
222 | options?: QueryOptions<T> | null,
|
223 | callback?: Callback<ResultDoc | null>
|
224 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
225 | findById<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
226 | id: any,
|
227 | projection?: ProjectionType<T> | null,
|
228 | callback?: Callback<ResultDoc | null>
|
229 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
230 |
|
231 |
|
232 | findOne<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
233 | filter?: FilterQuery<T>,
|
234 | projection?: ProjectionType<T> | null,
|
235 | options?: QueryOptions<T> | null,
|
236 | callback?: Callback<ResultDoc | null>
|
237 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
238 | findOne<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
239 | filter?: FilterQuery<T>,
|
240 | projection?: ProjectionType<T> | null,
|
241 | callback?: Callback<ResultDoc | null>
|
242 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
243 | findOne<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
244 | filter?: FilterQuery<T>,
|
245 | callback?: Callback<ResultDoc | null>
|
246 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
247 |
|
248 | |
249 |
|
250 |
|
251 |
|
252 | hydrate(obj: any, projection?: AnyObject, options?: { setters?: boolean }): HydratedDocument<T, TMethodsAndOverrides, TVirtuals>;
|
253 |
|
254 | |
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | init(callback?: CallbackWithoutResult): Promise<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>;
|
263 |
|
264 |
|
265 | insertMany<DocContents = T>(docs: Array<DocContents | T>, options: InsertManyOptions & { lean: true; }, callback: Callback<Array<MergeType<MergeType<T, DocContents>, Require_id<T>>>>): void;
|
266 | insertMany<DocContents = T>(docs: Array<DocContents | T>, options: InsertManyOptions & { rawResult: true; }, callback: Callback<mongodb.InsertManyResult<T>>): void;
|
267 | insertMany<DocContents = T>(docs: Array<DocContents | T>, callback: Callback<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>): void;
|
268 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions & { lean: true; }, callback: Callback<Array<MergeType<MergeType<T, DocContents>, Require_id<T>>>>): void;
|
269 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions & { rawResult: true; }, callback: Callback<mongodb.InsertManyResult<T>>): void;
|
270 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions & { lean?: false | undefined }, callback: Callback<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>): void;
|
271 | insertMany<DocContents = T>(doc: DocContents, callback: Callback<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>): void;
|
272 |
|
273 | insertMany<DocContents = T>(docs: Array<DocContents | T>, options: InsertManyOptions & { lean: true; }): Promise<Array<MergeType<MergeType<T, DocContents>, Require_id<T>>>>;
|
274 | insertMany<DocContents = T>(docs: Array<DocContents | T>, options: InsertManyOptions & { rawResult: true; }): Promise<mongodb.InsertManyResult<T>>;
|
275 | insertMany<DocContents = T>(docs: Array<DocContents | T>): Promise<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>;
|
276 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions & { lean: true; }): Promise<Array<MergeType<MergeType<T, DocContents>, Require_id<T>>>>;
|
277 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions & { rawResult: true; }): Promise<mongodb.InsertManyResult<T>>;
|
278 | insertMany<DocContents = T>(doc: DocContents, options: InsertManyOptions): Promise<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>;
|
279 | insertMany<DocContents = T>(doc: DocContents): Promise<Array<HydratedDocument<MergeType<MergeType<T, DocContents>, Require_id<T>>, TMethodsAndOverrides, TVirtuals>>>;
|
280 |
|
281 |
|
282 | modelName: string;
|
283 |
|
284 |
|
285 | populate(docs: Array<any>, options: PopulateOptions | Array<PopulateOptions> | string,
|
286 | callback?: Callback<(HydratedDocument<T, TMethodsAndOverrides, TVirtuals>)[]>): Promise<Array<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>>;
|
287 | populate(doc: any, options: PopulateOptions | Array<PopulateOptions> | string,
|
288 | callback?: Callback<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>): Promise<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>;
|
289 |
|
290 |
|
291 |
|
292 | validate(callback?: CallbackWithoutResult): Promise<void>;
|
293 | validate(optional: any, callback?: CallbackWithoutResult): Promise<void>;
|
294 | validate(optional: any, pathsToValidate: PathsToValidate, callback?: CallbackWithoutResult): Promise<void>;
|
295 |
|
296 |
|
297 | watch<ResultType extends mongodb.Document = any>(pipeline?: Array<Record<string, unknown>>, options?: mongodb.ChangeStreamOptions & { hydrate?: boolean }): mongodb.ChangeStream<ResultType>;
|
298 |
|
299 |
|
300 | $where(argument: string | Function): QueryWithHelpers<Array<HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
301 |
|
302 |
|
303 | discriminators: { [name: string]: Model<any> } | undefined;
|
304 |
|
305 |
|
306 | translateAliases(raw: any): any;
|
307 |
|
308 |
|
309 | distinct<ReturnType = any>(field: string, filter?: FilterQuery<T>, callback?: Callback<number>): QueryWithHelpers<Array<ReturnType>, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
310 |
|
311 |
|
312 | estimatedDocumentCount(options?: QueryOptions<T>, callback?: Callback<number>): QueryWithHelpers<number, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
313 |
|
314 | |
315 |
|
316 |
|
317 |
|
318 | exists(filter: FilterQuery<T>, callback: Callback<{ _id: InferId<T> } | null>): QueryWithHelpers<Pick<Document<T>, '_id'> | null, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
319 | exists(filter: FilterQuery<T>): QueryWithHelpers<{ _id: InferId<T> } | null, HydratedDocument<T, TMethodsAndOverrides, TVirtuals>, TQueryHelpers, T>;
|
320 |
|
321 |
|
322 | find<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
323 | filter: FilterQuery<T>,
|
324 | projection?: ProjectionType<T> | null | undefined,
|
325 | options?: QueryOptions<T> | null | undefined,
|
326 | callback?: Callback<ResultDoc[]> | undefined
|
327 | ): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
328 | find<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
329 | filter: FilterQuery<T>,
|
330 | projection?: ProjectionType<T> | null | undefined,
|
331 | callback?: Callback<ResultDoc[]> | undefined
|
332 | ): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
333 | find<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
334 | filter: FilterQuery<T>,
|
335 | callback?: Callback<ResultDoc[]> | undefined
|
336 | ): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
337 | find<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
338 | callback?: Callback<ResultDoc[]> | undefined
|
339 | ): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
340 |
|
341 |
|
342 | findByIdAndDelete<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id?: mongodb.ObjectId | any, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
343 |
|
344 | /** Creates a `findByIdAndRemove` query, filtering by the given `_id`. */
|
345 | findByIdAndRemove<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id?: mongodb.ObjectId | any, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
346 |
|
347 | /** Creates a `findOneAndUpdate` query, filtering by the given `_id`. */
|
348 | findByIdAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id: mongodb.ObjectId | any, update: UpdateQuery<T>, options: QueryOptions<T> & { rawResult: true }, callback?: (err: CallbackError, doc: any, res: any) => void): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
349 | findByIdAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id: mongodb.ObjectId | any, update: UpdateQuery<T>, options: QueryOptions<T> & { upsert: true } & ReturnsNewDoc, callback?: (err: CallbackError, doc: ResultDoc, res: any) => void): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, T>;
|
350 | findByIdAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id?: mongodb.ObjectId | any, update?: UpdateQuery<T>, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
351 | findByIdAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(id: mongodb.ObjectId | any, update: UpdateQuery<T>, callback: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
352 |
|
353 | /** Creates a `findOneAndDelete` query: atomically finds the given document, deletes it, and returns the document as it was before deletion. */
|
354 | findOneAndDelete<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter?: FilterQuery<T>, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
355 |
|
356 | /** Creates a `findOneAndRemove` query: atomically finds the given document and deletes it. */
|
357 | findOneAndRemove<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter?: FilterQuery<T>, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
358 |
|
359 | /** Creates a `findOneAndReplace` query: atomically finds the given document and replaces it with `replacement`. */
|
360 | findOneAndReplace<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter: FilterQuery<T>, replacement: T | AnyObject, options: QueryOptions<T> & { rawResult: true }, callback?: (err: CallbackError, doc: any, res: any) => void): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
361 | findOneAndReplace<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter: FilterQuery<T>, replacement: T | AnyObject, options: QueryOptions<T> & { upsert: true } & ReturnsNewDoc, callback?: (err: CallbackError, doc: ResultDoc, res: any) => void): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, T>;
|
362 | findOneAndReplace<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter?: FilterQuery<T>, replacement?: T | AnyObject, options?: QueryOptions<T> | null, callback?: (err: CallbackError, doc: ResultDoc | null, res: any) => void): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
363 |
|
364 | /** Creates a `findOneAndUpdate` query: atomically find the first document that matches `filter` and apply `update`. */
|
365 | findOneAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
366 | filter: FilterQuery<T>,
|
367 | update: UpdateQuery<T>,
|
368 | options: QueryOptions<T> & { rawResult: true },
|
369 | callback?: (err: CallbackError, doc: any, res: any) => void
|
370 | ): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
371 | findOneAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
372 | filter: FilterQuery<T>,
|
373 | update: UpdateQuery<T>,
|
374 | options: QueryOptions<T> & { upsert: true } & ReturnsNewDoc,
|
375 | callback?: (err: CallbackError, doc: ResultDoc, res: any) => void
|
376 | ): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, T>;
|
377 | findOneAndUpdate<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
378 | filter?: FilterQuery<T>,
|
379 | update?: UpdateQuery<T>,
|
380 | options?: QueryOptions<T> | null,
|
381 | callback?: (err: CallbackError, doc: T | null, res: any) => void
|
382 | ): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, T>;
|
383 |
|
384 | geoSearch<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
385 | filter?: FilterQuery<T>,
|
386 | options?: GeoSearchOptions,
|
387 | callback?: Callback<Array<ResultDoc>>
|
388 | ): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
389 |
|
390 | /** Executes a mapReduce command. */
|
391 | mapReduce<Key, Value>(
|
392 | o: MapReduceOptions<T, Key, Value>,
|
393 | callback?: Callback
|
394 | ): Promise<any>;
|
395 |
|
396 | remove<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter?: any, callback?: CallbackWithoutResult): QueryWithHelpers<any, ResultDoc, TQueryHelpers, T>;
|
397 | remove<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(filter?: any, options?: RemoveOptions, callback?: CallbackWithoutResult): QueryWithHelpers<any, ResultDoc, TQueryHelpers, T>;
|
398 |
|
399 | /** Creates a `replaceOne` query: finds the first document that matches `filter` and replaces it with `replacement`. */
|
400 | replaceOne<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
401 | filter?: FilterQuery<T>,
|
402 | replacement?: T | AnyObject,
|
403 | options?: QueryOptions<T> | null,
|
404 | callback?: Callback
|
405 | ): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, T>;
|
406 |
|
407 | /** Schema the model uses. */
|
408 | schema: Schema<T>;
|
409 |
|
410 | /**
|
411 | * @deprecated use `updateOne` or `updateMany` instead.
|
412 | * Creates a `update` query: updates one or many documents that match `filter` with `update`, based on the `multi` option.
|
413 | */
|
414 | update<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
415 | filter?: FilterQuery<T>,
|
416 | update?: UpdateQuery<T> | UpdateWithAggregationPipeline,
|
417 | options?: QueryOptions<T> | null,
|
418 | callback?: Callback
|
419 | ): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, T>;
|
420 |
|
421 | /** Creates a `updateMany` query: updates all documents that match `filter` with `update`. */
|
422 | updateMany<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
423 | filter?: FilterQuery<T>,
|
424 | update?: UpdateQuery<T> | UpdateWithAggregationPipeline,
|
425 | options?: QueryOptions<T> | null,
|
426 | callback?: Callback
|
427 | ): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, T>;
|
428 |
|
429 | /** Creates a `updateOne` query: updates the first document that matches `filter` with `update`. */
|
430 | updateOne<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(
|
431 | filter?: FilterQuery<T>,
|
432 | update?: UpdateQuery<T> | UpdateWithAggregationPipeline,
|
433 | options?: QueryOptions<T> | null,
|
434 | callback?: Callback
|
435 | ): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, T>;
|
436 |
|
437 | /** Creates a Query, applies the passed conditions, and returns the Query. */
|
438 | where<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(path: string, val?: any): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
439 | where<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(obj: object): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
440 | where<ResultDoc = HydratedDocument<T, TMethodsAndOverrides, TVirtuals>>(): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, T>;
|
441 | }
|
442 | }
|
443 |
|
\ | No newline at end of file |