deno.land / x / mongoose@6.7.5 / types / aggregate.d.ts

aggregate.d.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
declare module 'mongoose' { import mongodb = require('mongodb');
/** Extract generic type from Aggregate class */ type AggregateExtract<P> = P extends Aggregate<infer T> ? T : never;
interface AggregateOptions extends SessionOption { /** * If true, the MongoDB server will use the hard drive to store data during this aggregation. */ allowDiskUse?: boolean; /** * Applicable only if you specify the $out or $merge aggregation stages. * * Enables db.collection.aggregate() to bypass document validation during the operation. This lets you insert documents that do not meet the validation requirements. */ bypassDocumentValidation?: boolean; /** * The BSON-serializer will check if keys are valid */ collation?: mongodb.CollationOptions; /** * Users can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs. */ comment?: string; /** * Specifies the initial batch size for the cursor. The value of the cursor field is a document with the field batchSize. */ cursor?: { batchSize?: number; };
/** * Specifies to return the information on the processing of the pipeline. See Return Information on Aggregation Pipeline Operation for an example. * * Not available in multi-document transactions. */ explain?: mongodb.ExplainVerbosityLike; /** * The index to use for the aggregation. The index is on the initial collection/view against which the aggregation is run. */ hint?: string | AnyObject; /** * Specifies a document with a list of variables. This allows you to improve command readability by separating the variables from the query text. */ let?: AnyObject; /** * Specifies a time limit in milliseconds for processing operations on a cursor. If you do not specify a value for maxTimeMS, operations will not time out. A value of 0 explicitly specifies the default unbounded behavior. * * @see https://docs.mongodb.com/manual/reference/operator/meta/maxTimeMS/ */ maxTimeMS?: number; /** * Return BSON filled buffers from operations. */ raw?: boolean; /** * Specifies the read concern. */ readConcern?: mongodb.ReadConcernLike; /** * The preferred read preference. */ readPreference?: mongodb.ReadPreferenceLike; /** * Specifies the write concern. */ writeConcern?: mongodb.WriteConcern; [key: string]: any; }
class Aggregate<R> implements SessionOperation { /** * Returns an asyncIterator for use with [`for/await/of` loops](https://thecodebarbarian.com/getting-started-with-async-iterators-in-node-js) * You do not need to call this function explicitly, the JavaScript runtime * will call it for you. */ [Symbol.asyncIterator](): AsyncIterableIterator<Unpacked<R>>;
options: AggregateOptions;
/** * Sets an option on this aggregation. This function will be deprecated in a * future release. * * @deprecated */ addCursorFlag(flag: CursorFlag, value: boolean): this;
/** * Appends a new $addFields operator to this aggregate pipeline. * Requires MongoDB v3.4+ to work */ addFields(arg: PipelineStage.AddFields['$addFields']): this;
/** Sets the allowDiskUse option for the aggregation query */ allowDiskUse(value: boolean): this;
/** Appends new operators to this aggregate pipeline */ append(...args: PipelineStage[]): this;
/** * Executes the query returning a `Promise` which will be * resolved with either the doc(s) or rejected with the error. * Like [`.then()`](#query_Query-then), but only takes a rejection handler. */ catch: Promise<R>['catch'];
/** Set the collation. */ collation(options: mongodb.CollationOptions): this;
/** Appends a new $count operator to this aggregate pipeline. */ count(fieldName: PipelineStage.Count['$count']): this;
/** Appends a new $densify operator to this aggregate pipeline */ densify(arg: PipelineStage.Densify['$densify']): this;
/** * Sets the cursor option for the aggregation query */ cursor<DocType = any>(options?: Record<string, unknown>): Cursor<DocType>;

/** Executes the aggregate pipeline on the currently bound Model. */ exec(callback: Callback<R>): void; exec(): Promise<R>;
/** Execute the aggregation with explain */ explain(verbosity: mongodb.ExplainVerbosityLike, callback: Callback<AnyObject>): void; explain(verbosity: mongodb.ExplainVerbosityLike): Promise<AnyObject>; explain(callback: Callback<AnyObject>): void; explain(): Promise<AnyObject>;
/** Combines multiple aggregation pipelines. */ facet(options: PipelineStage.Facet['$facet']): this;
/** Appends a new $fill operator to this aggregate pipeline */ fill(arg: PipelineStage.Fill['$fill']): this;
/** Appends new custom $graphLookup operator(s) to this aggregate pipeline, performing a recursive search on a collection. */ graphLookup(options: PipelineStage.GraphLookup['$graphLookup']): this;
/** Appends new custom $group operator to this aggregate pipeline. */ group(arg: PipelineStage.Group['$group']): this;
/** Sets the hint option for the aggregation query */ hint(value: Record<string, unknown> | string): this;
/** * Appends a new $limit operator to this aggregate pipeline. * @param num maximum number of records to pass to the next stage */ limit(num: PipelineStage.Limit['$limit']): this;
/** Appends new custom $lookup operator to this aggregate pipeline. */ lookup(options: PipelineStage.Lookup['$lookup']): this;
/** * Appends a new custom $match operator to this aggregate pipeline. * @param arg $match operator contents */ match(arg: PipelineStage.Match['$match']): this;
/** * Binds this aggregate to a model. * @param model the model to which the aggregate is to be bound */ model(model: Model<any>): this;
/** * Append a new $near operator to this aggregation pipeline * @param arg $near operator contents */ near(arg: { near?: number[]; distanceField: string; maxDistance?: number; query?: Record<string, any>; includeLocs?: string; num?: number; uniqueDocs?: boolean }): this;
/** Returns the current pipeline */ pipeline(): PipelineStage[];
/** Appends a new $project operator to this aggregate pipeline. */ project(arg: PipelineStage.Project['$project']): this;
/** Sets the readPreference option for the aggregation query. */ read(pref: mongodb.ReadPreferenceLike): this;
/** Sets the readConcern level for the aggregation query. */ readConcern(level: string): this;
/** Appends a new $redact operator to this aggregate pipeline. */ redact(expression: PipelineStage.Redact['$redact'], thenExpr: '$$DESCEND' | '$$PRUNE' | '$$KEEP' | AnyObject, elseExpr: '$$DESCEND' | '$$PRUNE' | '$$KEEP' | AnyObject): this;
/** Appends a new $replaceRoot operator to this aggregate pipeline. */ replaceRoot(newRoot: PipelineStage.ReplaceRoot['$replaceRoot']['newRoot'] | string): this;
/** * Helper for [Atlas Text Search](https://docs.atlas.mongodb.com/reference/atlas-search/tutorial/)'s * `$search` stage. */ search(options: PipelineStage.Search['$search']): this;
/** Lets you set arbitrary options, for middlewares or plugins. */ option(value: AggregateOptions): this;
/** Appends new custom $sample operator to this aggregate pipeline. */ sample(arg: PipelineStage.Sample['$sample']['size']): this;
/** Sets the session for this aggregation. Useful for [transactions](/docs/transactions.html). */ session(session: mongodb.ClientSession | null): this;
/** * Appends a new $skip operator to this aggregate pipeline. * @param num number of records to skip before next stage */ skip(num: PipelineStage.Skip['$skip']): this;
/** Appends a new $sort operator to this aggregate pipeline. */ sort(arg: string | Record<string, SortValues> | PipelineStage.Sort['$sort']): this;
/** Provides promise for aggregate. */ then: Promise<R>['then'];
/** * Appends a new $sortByCount operator to this aggregate pipeline. Accepts either a string field name * or a pipeline object. */ sortByCount(arg: string | PipelineStage.SortByCount['$sortByCount']): this;
/** Appends new $unionWith operator to this aggregate pipeline. */ unionWith(options: PipelineStage.UnionWith['$unionWith']): this;
/** Appends new custom $unwind operator(s) to this aggregate pipeline. */ unwind(...args: PipelineStage.Unwind['$unwind'][]): this; }}
mongoose

Version Info

Tagged at
a year ago