mongoose 6.2.1 → 6.2.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.
Files changed (52) hide show
  1. package/.eslintrc.json +5 -1
  2. package/CHANGELOG.md +19 -0
  3. package/dist/browser.umd.js +146 -139
  4. package/index.js +5 -1
  5. package/lib/aggregate.js +22 -27
  6. package/lib/browserDocument.js +1 -1
  7. package/lib/cast/number.js +2 -3
  8. package/lib/cast.js +7 -4
  9. package/lib/connection.js +43 -21
  10. package/lib/cursor/AggregationCursor.js +12 -7
  11. package/lib/cursor/QueryCursor.js +11 -6
  12. package/lib/document.js +27 -46
  13. package/lib/drivers/node-mongodb-native/collection.js +12 -4
  14. package/lib/drivers/node-mongodb-native/connection.js +11 -0
  15. package/lib/error/cast.js +3 -2
  16. package/lib/helpers/clone.js +11 -2
  17. package/lib/helpers/cursor/eachAsync.js +18 -15
  18. package/lib/helpers/document/compile.js +7 -4
  19. package/lib/helpers/printJestWarning.js +2 -2
  20. package/lib/helpers/projection/applyProjection.js +77 -0
  21. package/lib/helpers/projection/hasIncludedChildren.js +36 -0
  22. package/lib/helpers/projection/isExclusive.js +5 -2
  23. package/lib/helpers/projection/isInclusive.js +5 -1
  24. package/lib/helpers/query/cast$expr.js +14 -19
  25. package/lib/helpers/query/isOperator.js +5 -2
  26. package/lib/index.js +14 -17
  27. package/lib/model.js +124 -104
  28. package/lib/options/SchemaTypeOptions.js +1 -1
  29. package/lib/plugins/trackTransaction.js +1 -1
  30. package/lib/query.js +156 -144
  31. package/lib/queryhelpers.js +9 -9
  32. package/lib/schema/SubdocumentPath.js +4 -3
  33. package/lib/schema/array.js +13 -6
  34. package/lib/schema/buffer.js +1 -1
  35. package/lib/schema/date.js +1 -1
  36. package/lib/schema/decimal128.js +1 -1
  37. package/lib/schema/documentarray.js +4 -3
  38. package/lib/schema/number.js +1 -1
  39. package/lib/schema/objectid.js +1 -1
  40. package/lib/schema/string.js +4 -4
  41. package/lib/schema.js +8 -8
  42. package/lib/schematype.js +3 -4
  43. package/lib/types/DocumentArray/index.js +1 -1
  44. package/lib/types/array/index.js +2 -2
  45. package/lib/types/array/methods/index.js +10 -11
  46. package/lib/types/buffer.js +3 -3
  47. package/lib/types/map.js +2 -3
  48. package/package.json +2 -4
  49. package/tsconfig.json +0 -2
  50. package/types/PipelineStage.d.ts +272 -0
  51. package/types/index.d.ts +10 -271
  52. package/lib/types/array/ArrayWrapper.js +0 -981
@@ -0,0 +1,272 @@
1
+ declare module 'mongoose' {
2
+ /**
3
+ * [Stages reference](https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/#aggregation-pipeline-stages)
4
+ */
5
+ export type PipelineStage =
6
+ | PipelineStage.AddFields
7
+ | PipelineStage.Bucket
8
+ | PipelineStage.BucketAuto
9
+ | PipelineStage.CollStats
10
+ | PipelineStage.Count
11
+ | PipelineStage.Facet
12
+ | PipelineStage.GeoNear
13
+ | PipelineStage.GraphLookup
14
+ | PipelineStage.Group
15
+ | PipelineStage.IndexStats
16
+ | PipelineStage.Limit
17
+ | PipelineStage.ListSessions
18
+ | PipelineStage.Lookup
19
+ | PipelineStage.Match
20
+ | PipelineStage.Merge
21
+ | PipelineStage.Out
22
+ | PipelineStage.PlanCacheStats
23
+ | PipelineStage.Project
24
+ | PipelineStage.Redact
25
+ | PipelineStage.ReplaceRoot
26
+ | PipelineStage.ReplaceWith
27
+ | PipelineStage.Sample
28
+ | PipelineStage.Search
29
+ | PipelineStage.Set
30
+ | PipelineStage.SetWindowFields
31
+ | PipelineStage.Skip
32
+ | PipelineStage.Sort
33
+ | PipelineStage.SortByCount
34
+ | PipelineStage.UnionWith
35
+ | PipelineStage.Unset
36
+ | PipelineStage.Unwind
37
+
38
+ export namespace PipelineStage {
39
+ export interface AddFields {
40
+ /** [`$addFields` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/) */
41
+ $addFields: Record<string, any>
42
+ }
43
+
44
+ export interface Bucket {
45
+ /** [`$bucket` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/bucket/) */
46
+ $bucket: {
47
+ groupBy: any
48
+ boundaries: any[]
49
+ default?: any
50
+ output?: Record<string, { [op in AccumulatorOperator]?: any }>
51
+ }
52
+ }
53
+
54
+ export interface BucketAuto {
55
+ /** [`$bucketAuto` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/) */
56
+ $bucketAuto: {
57
+ groupBy: any
58
+ buckets: number
59
+ output?: Record<string, { [op in AccumulatorOperator]?: any }>
60
+ granularity?: 'R5' | 'R10' | 'R20' | 'R40' | 'R80' | '1-2-5' | 'E6' | 'E12' | 'E24' | 'E48' | 'E96' | 'E192' | 'POWERSOF2'
61
+ }
62
+ }
63
+
64
+ export interface CollStats {
65
+ /** [`$collStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/collStats/) */
66
+ $collStats: {
67
+ latencyStats?: { histograms?: boolean }
68
+ storageStats?: { scale?: number }
69
+ count?: {}
70
+ queryExecStats?: {}
71
+ }
72
+ }
73
+
74
+ export interface Count {
75
+ /** [`$count` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/count/) */
76
+ $count: string
77
+ }
78
+
79
+ export interface Facet {
80
+ /** [`$facet` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/facet/) */
81
+ $facet: Record<string, FacetPipelineStage[]>
82
+ }
83
+
84
+ export type FacetPipelineStage = Exclude<PipelineStage, PipelineStage.CollStats | PipelineStage.Facet | PipelineStage.GeoNear | PipelineStage.IndexStats | PipelineStage.Out | PipelineStage.Merge | PipelineStage.PlanCacheStats>
85
+
86
+ export interface GeoNear {
87
+ /** [`$geoNear` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/) */
88
+ $geoNear: {
89
+ near: { type: 'Point'; coordinates: [number, number] } | [number, number]
90
+ distanceField: string
91
+ distanceMultiplier?: number
92
+ includeLocs?: string
93
+ key?: string
94
+ maxDistance?: number
95
+ minDistance?: number
96
+ query?: AnyObject
97
+ spherical?: boolean
98
+ uniqueDocs?: boolean
99
+ }
100
+ }
101
+
102
+ export interface GraphLookup {
103
+ /** [`$graphLookup` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/graphLookup/) */
104
+ $graphLookup: {
105
+ from: string
106
+ startWith: any
107
+ connectFromField: string
108
+ connectToField: string
109
+ as: string
110
+ maxDepth?: number
111
+ depthField?: string
112
+ restrictSearchWithMatch?: AnyObject
113
+ }
114
+ }
115
+
116
+ export interface Group {
117
+ /** [`$group` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/group) */
118
+ $group: { _id: any } | { [key: string]: { [op in AccumulatorOperator]?: any } }
119
+ }
120
+
121
+ export interface IndexStats {
122
+ /** [`$indexStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/indexStats/) */
123
+ $indexStats: {}
124
+ }
125
+
126
+ export interface Limit {
127
+ /** [`$limit` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/limit/) */
128
+ $limit: number
129
+ }
130
+
131
+ export interface ListSessions {
132
+ /** [`$listSessions` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/listSessions/) */
133
+ $listSessions: { users?: { user: string; db: string }[] } | { allUsers?: true }
134
+ }
135
+
136
+ export interface Lookup {
137
+ /** [`$lookup` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/) */
138
+ $lookup: {
139
+ from: string
140
+ as: string
141
+ localField?: string
142
+ foreignField?: string
143
+ let?: Record<string, any>
144
+ pipeline?: Exclude<PipelineStage, PipelineStage.Merge | PipelineStage.Out | PipelineStage.Search>[]
145
+ }
146
+ }
147
+
148
+ export interface Match {
149
+ /** [`$match` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/match/) */
150
+ $match: AnyObject
151
+ }
152
+
153
+ export interface Merge {
154
+ /** [`$merge` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/merge/) */
155
+ $merge: {
156
+ into: string | { db: string; coll: string }
157
+ on?: string | string[]
158
+ let?: Record<string, any>
159
+ whenMatched?: 'replace' | 'keepExisting' | 'merge' | 'fail' | Extract<PipelineStage, PipelineStage.AddFields | PipelineStage.Set | PipelineStage.Project | PipelineStage.Unset | PipelineStage.ReplaceRoot | PipelineStage.ReplaceWith>[]
160
+ whenNotMatched?: 'insert' | 'discard' | 'fail'
161
+ }
162
+ }
163
+
164
+ export interface Out {
165
+ /** [`$out` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/out/) */
166
+ $out: string | { db: string; coll: string }
167
+ }
168
+
169
+ export interface PlanCacheStats {
170
+ /** [`$planCacheStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/planCacheStats/) */
171
+ $planCacheStats: {}
172
+ }
173
+
174
+ export interface Project {
175
+ /** [`$project` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/project/) */
176
+ $project: { [field: string]: any }
177
+ }
178
+
179
+ export interface Redact {
180
+ /** [`$redact` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/redact/) */
181
+ $redact: any
182
+ }
183
+
184
+ export interface ReplaceRoot {
185
+ /** [`$replaceRoot` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot/) */
186
+ $replaceRoot: { newRoot: any }
187
+ }
188
+
189
+ export interface ReplaceWith {
190
+ /** [`$replaceWith` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/replaceWith/) */
191
+ $replaceWith: any
192
+ }
193
+
194
+ export interface Sample {
195
+ /** [`$sample` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sample/) */
196
+ $sample: { size: number }
197
+ }
198
+
199
+ export interface Search {
200
+ /** [`$search` reference](https://docs.atlas.mongodb.com/reference/atlas-search/query-syntax/) */
201
+ $search: {
202
+ index?: string;
203
+ highlight?: {
204
+ /** [`highlightPath` reference](https://docs.atlas.mongodb.com/atlas-search/path-construction/#multiple-field-search) */
205
+ path: string | string[] | { value: string, multi: string};
206
+ maxCharsToExamine?: number;
207
+ maxNumPassages?: number;
208
+ };
209
+ [key: string]: any;
210
+ }
211
+ }
212
+
213
+ export interface Set {
214
+ /** [`$set` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/set/) */
215
+ $set: Record<string, any>
216
+ }
217
+
218
+ export interface SetWindowFields {
219
+ /** [`$setWindowFields` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/setWindowFields/) */
220
+ $setWindowFields: {
221
+ partitionBy?: any
222
+ sortBy?: Record<string, 1 | -1>
223
+ output: Record<
224
+ string,
225
+ { [op in WindowOperator]?: any } & {
226
+ window?: {
227
+ documents?: [string | number, string | number]
228
+ range?: [string | number, string | number]
229
+ unit?: 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'
230
+ }
231
+ }
232
+ >
233
+ }
234
+ }
235
+
236
+ export interface Skip {
237
+ /** [`$skip` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/skip/) */
238
+ $skip: number
239
+ }
240
+
241
+ export interface Sort {
242
+ /** [`$sort` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sort/) */
243
+ $sort: Record<string, 1 | -1 | { $meta: 'textScore' }>
244
+ }
245
+
246
+ export interface SortByCount {
247
+ /** [`$sortByCount` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sortByCount/) */
248
+ $sortByCount: any
249
+ }
250
+
251
+ export interface UnionWith {
252
+ /** [`$unionWith` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unionWith/) */
253
+ $unionWith:
254
+ | string
255
+ | { coll: string; pipeline?: Exclude<PipelineStage, PipelineStage.Out | PipelineStage.Merge>[] }
256
+ }
257
+
258
+ export interface Unset {
259
+ /** [`$unset` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unset/) */
260
+ $unset: string | string[]
261
+ }
262
+
263
+ export interface Unwind {
264
+ /** [`$unwind` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/) */
265
+ $unwind: string | { path: string; includeArrayIndex?: string; preserveNullAndEmptyArrays?: boolean }
266
+ }
267
+
268
+ type AccumulatorOperator = '$accumulator' | '$addToSet' | '$avg' | '$count' | '$first' | '$last' | '$max' | '$mergeObjects' | '$min' | '$push' | '$stdDevPop' | '$stdDevSamp' | '$sum'
269
+
270
+ type WindowOperator = '$addToSet' | '$avg' | '$count' | '$covariancePop' | '$covarianceSamp' | '$derivative' | '$expMovingAvg' | '$integral' | '$max' | '$min' | '$push' | '$stdDevSamp' | '$stdDevPop' | '$sum' | '$first' | '$last' | '$shift' | '$denseRank' | '$documentNumber' | '$rank'
271
+ }
272
+ }
package/types/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ /// <reference path="./PipelineStage.d.ts" />
2
+
3
+ import events = require('events');
4
+ import mongodb = require('mongodb');
5
+ import mongoose = require('mongoose');
6
+ import stream = require('stream');
7
+
1
8
  declare module 'mongoose' {
2
- import events = require('events');
3
- import mongodb = require('mongodb');
4
- import mongoose = require('mongoose');
5
- import stream = require('stream');
6
9
 
7
10
  export enum ConnectionStates {
8
11
  disconnected = 0,
@@ -114,7 +117,7 @@ declare module 'mongoose' {
114
117
  /** Gets mongoose options */
115
118
  export function get<K extends keyof MongooseOptions>(key: K): MongooseOptions[K];
116
119
 
117
- /*! ignore */
120
+ /* ! ignore */
118
121
  type CompileModelOptions = { overwriteModels?: boolean, connection?: Connection };
119
122
 
120
123
  /**
@@ -2997,272 +3000,6 @@ declare module 'mongoose' {
2997
3000
  next(callback: Callback): void;
2998
3001
  }
2999
3002
 
3000
- /**
3001
- * [Stages reference](https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/#aggregation-pipeline-stages)
3002
- */
3003
- export type PipelineStage =
3004
- | PipelineStage.AddFields
3005
- | PipelineStage.Bucket
3006
- | PipelineStage.BucketAuto
3007
- | PipelineStage.CollStats
3008
- | PipelineStage.Count
3009
- | PipelineStage.Facet
3010
- | PipelineStage.GeoNear
3011
- | PipelineStage.GraphLookup
3012
- | PipelineStage.Group
3013
- | PipelineStage.IndexStats
3014
- | PipelineStage.Limit
3015
- | PipelineStage.ListSessions
3016
- | PipelineStage.Lookup
3017
- | PipelineStage.Match
3018
- | PipelineStage.Merge
3019
- | PipelineStage.Out
3020
- | PipelineStage.PlanCacheStats
3021
- | PipelineStage.Project
3022
- | PipelineStage.Redact
3023
- | PipelineStage.ReplaceRoot
3024
- | PipelineStage.ReplaceWith
3025
- | PipelineStage.Sample
3026
- | PipelineStage.Search
3027
- | PipelineStage.Set
3028
- | PipelineStage.SetWindowFields
3029
- | PipelineStage.Skip
3030
- | PipelineStage.Sort
3031
- | PipelineStage.SortByCount
3032
- | PipelineStage.UnionWith
3033
- | PipelineStage.Unset
3034
- | PipelineStage.Unwind
3035
-
3036
- export namespace PipelineStage {
3037
- export interface AddFields {
3038
- /** [`$addFields` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/) */
3039
- $addFields: Record<string, any>
3040
- }
3041
-
3042
- export interface Bucket {
3043
- /** [`$bucket` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/bucket/) */
3044
- $bucket: {
3045
- groupBy: any
3046
- boundaries: any[]
3047
- default?: any
3048
- output?: Record<string, { [op in AccumulatorOperator]?: any }>
3049
- }
3050
- }
3051
-
3052
- export interface BucketAuto {
3053
- /** [`$bucketAuto` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/) */
3054
- $bucketAuto: {
3055
- groupBy: any
3056
- buckets: number
3057
- output?: Record<string, { [op in AccumulatorOperator]?: any }>
3058
- granularity?: 'R5' | 'R10' | 'R20' | 'R40' | 'R80' | '1-2-5' | 'E6' | 'E12' | 'E24' | 'E48' | 'E96' | 'E192' | 'POWERSOF2'
3059
- }
3060
- }
3061
-
3062
- export interface CollStats {
3063
- /** [`$collStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/collStats/) */
3064
- $collStats: {
3065
- latencyStats?: { histograms?: boolean }
3066
- storageStats?: { scale?: number }
3067
- count?: {}
3068
- queryExecStats?: {}
3069
- }
3070
- }
3071
-
3072
- export interface Count {
3073
- /** [`$count` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/count/) */
3074
- $count: string
3075
- }
3076
-
3077
- export interface Facet {
3078
- /** [`$facet` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/facet/) */
3079
- $facet: Record<string, FacetPipelineStage[]>
3080
- }
3081
-
3082
- export type FacetPipelineStage = Exclude<PipelineStage, PipelineStage.CollStats | PipelineStage.Facet | PipelineStage.GeoNear | PipelineStage.IndexStats | PipelineStage.Out | PipelineStage.Merge | PipelineStage.PlanCacheStats>
3083
-
3084
- export interface GeoNear {
3085
- /** [`$geoNear` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/) */
3086
- $geoNear: {
3087
- near: { type: 'Point'; coordinates: [number, number] } | [number, number]
3088
- distanceField: string
3089
- distanceMultiplier?: number
3090
- includeLocs?: string
3091
- key?: string
3092
- maxDistance?: number
3093
- minDistance?: number
3094
- query?: AnyObject
3095
- spherical?: boolean
3096
- uniqueDocs?: boolean
3097
- }
3098
- }
3099
-
3100
- export interface GraphLookup {
3101
- /** [`$graphLookup` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/graphLookup/) */
3102
- $graphLookup: {
3103
- from: string
3104
- startWith: any
3105
- connectFromField: string
3106
- connectToField: string
3107
- as: string
3108
- maxDepth?: number
3109
- depthField?: string
3110
- restrictSearchWithMatch?: AnyObject
3111
- }
3112
- }
3113
-
3114
- export interface Group {
3115
- /** [`$group` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/group) */
3116
- $group: { _id: any } | { [key: string]: { [op in AccumulatorOperator]?: any } }
3117
- }
3118
-
3119
- export interface IndexStats {
3120
- /** [`$indexStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/indexStats/) */
3121
- $indexStats: {}
3122
- }
3123
-
3124
- export interface Limit {
3125
- /** [`$limit` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/limit/) */
3126
- $limit: number
3127
- }
3128
-
3129
- export interface ListSessions {
3130
- /** [`$listSessions` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/listSessions/) */
3131
- $listSessions: { users?: { user: string; db: string }[] } | { allUsers?: true }
3132
- }
3133
-
3134
- export interface Lookup {
3135
- /** [`$lookup` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/) */
3136
- $lookup: {
3137
- from: string
3138
- as: string
3139
- localField?: string
3140
- foreignField?: string
3141
- let?: Record<string, any>
3142
- pipeline?: Exclude<PipelineStage, PipelineStage.Merge | PipelineStage.Out | PipelineStage.Search>[]
3143
- }
3144
- }
3145
-
3146
- export interface Match {
3147
- /** [`$match` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/match/) */
3148
- $match: AnyObject
3149
- }
3150
-
3151
- export interface Merge {
3152
- /** [`$merge` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/merge/) */
3153
- $merge: {
3154
- into: string | { db: string; coll: string }
3155
- on?: string | string[]
3156
- let?: Record<string, any>
3157
- whenMatched?: 'replace' | 'keepExisting' | 'merge' | 'fail' | Extract<PipelineStage, PipelineStage.AddFields | PipelineStage.Set | PipelineStage.Project | PipelineStage.Unset | PipelineStage.ReplaceRoot | PipelineStage.ReplaceWith>[]
3158
- whenNotMatched?: 'insert' | 'discard' | 'fail'
3159
- }
3160
- }
3161
-
3162
- export interface Out {
3163
- /** [`$out` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/out/) */
3164
- $out: string | { db: string; coll: string }
3165
- }
3166
-
3167
- export interface PlanCacheStats {
3168
- /** [`$planCacheStats` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/planCacheStats/) */
3169
- $planCacheStats: {}
3170
- }
3171
-
3172
- export interface Project {
3173
- /** [`$project` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/project/) */
3174
- $project: { [field: string]: any }
3175
- }
3176
-
3177
- export interface Redact {
3178
- /** [`$redact` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/redact/) */
3179
- $redact: any
3180
- }
3181
-
3182
- export interface ReplaceRoot {
3183
- /** [`$replaceRoot` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot/) */
3184
- $replaceRoot: { newRoot: any }
3185
- }
3186
-
3187
- export interface ReplaceWith {
3188
- /** [`$replaceWith` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/replaceWith/) */
3189
- $replaceWith: any
3190
- }
3191
-
3192
- export interface Sample {
3193
- /** [`$sample` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sample/) */
3194
- $sample: { size: number }
3195
- }
3196
-
3197
- export interface Search {
3198
- /** [`$search` reference](https://docs.atlas.mongodb.com/reference/atlas-search/query-syntax/) */
3199
- $search: {
3200
- [key: string]: any
3201
- index?: string
3202
- highlight?: { path: string; maxCharsToExamine?: number; maxNumPassages?: number }
3203
- }
3204
- }
3205
-
3206
- export interface Set {
3207
- /** [`$set` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/set/) */
3208
- $set: Record<string, any>
3209
- }
3210
-
3211
- export interface SetWindowFields {
3212
- /** [`$setWindowFields` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/setWindowFields/) */
3213
- $setWindowFields: {
3214
- partitionBy?: any
3215
- sortBy?: Record<string, 1 | -1>
3216
- output: Record<
3217
- string,
3218
- { [op in WindowOperator]?: any } & {
3219
- window?: {
3220
- documents?: [string | number, string | number]
3221
- range?: [string | number, string | number]
3222
- unit?: 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'
3223
- }
3224
- }
3225
- >
3226
- }
3227
- }
3228
-
3229
- export interface Skip {
3230
- /** [`$skip` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/skip/) */
3231
- $skip: number
3232
- }
3233
-
3234
- export interface Sort {
3235
- /** [`$sort` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sort/) */
3236
- $sort: Record<string, 1 | -1 | { $meta: 'textScore' }>
3237
- }
3238
-
3239
- export interface SortByCount {
3240
- /** [`$sortByCount` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/sortByCount/) */
3241
- $sortByCount: any
3242
- }
3243
-
3244
- export interface UnionWith {
3245
- /** [`$unionWith` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unionWith/) */
3246
- $unionWith:
3247
- | string
3248
- | { coll: string; pipeline?: Exclude<PipelineStage, PipelineStage.Out | PipelineStage.Merge>[] }
3249
- }
3250
-
3251
- export interface Unset {
3252
- /** [`$unset` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unset/) */
3253
- $unset: string | string[]
3254
- }
3255
-
3256
- export interface Unwind {
3257
- /** [`$unwind` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/) */
3258
- $unwind: string | { path: string; includeArrayIndex?: string; preserveNullAndEmptyArrays?: boolean }
3259
- }
3260
-
3261
- type AccumulatorOperator = '$accumulator' | '$addToSet' | '$avg' | '$count' | '$first' | '$last' | '$max' | '$mergeObjects' | '$min' | '$push' | '$stdDevPop' | '$stdDevSamp' | '$sum'
3262
-
3263
- type WindowOperator = '$addToSet' | '$avg' | '$count' | '$covariancePop' | '$covarianceSamp' | '$derivative' | '$expMovingAvg' | '$integral' | '$max' | '$min' | '$push' | '$stdDevSamp' | '$stdDevPop' | '$sum' | '$first' | '$last' | '$shift' | '$denseRank' | '$documentNumber' | '$rank'
3264
- }
3265
-
3266
3003
  class SchemaType {
3267
3004
  /** SchemaType constructor */
3268
3005
  constructor(path: string, options?: AnyObject, instance?: string);
@@ -3489,3 +3226,5 @@ declare module 'mongoose' {
3489
3226
  /* for ts-mongoose */
3490
3227
  class mquery {}
3491
3228
  }
3229
+
3230
+ export default mongoose;