@@ -95,81 +95,95 @@ declare module 'mongoose' {
95
95
updatedAt ?: boolean ;
96
96
}
97
97
98
- interface QueryOptions < DocType = unknown > extends
99
- PopulateOption ,
100
- SessionOption {
101
- arrayFilters ?: { [ key : string ] : any } [ ] ;
102
- batchSize ?: number ;
103
- collation ?: mongodb . CollationOptions ;
104
- comment ?: any ;
105
- context ?: string ;
106
- explain ?: mongodb . ExplainVerbosityLike ;
107
- fields ?: any | string ;
108
- hint ?: mongodb . Hint ;
98
+ interface MongooseSpecificQueryOptions {
109
99
/**
110
100
* If truthy, mongoose will return the document as a plain JavaScript object rather than a mongoose document.
111
101
*/
112
102
lean ?: boolean | Record < string , any > ;
113
- limit ?: number ;
114
- maxTimeMS ?: number ;
115
- multi ?: boolean ;
103
+
116
104
multipleCastError ?: boolean ;
117
- /**
118
- * By default, `findOneAndUpdate()` returns the document as it was **before**
119
- * `update` was applied. If you set `new: true`, `findOneAndUpdate()` will
120
- * instead give you the object after `update` was applied.
121
- */
122
- new ?: boolean ;
123
105
124
106
overwriteDiscriminatorKey ?: boolean ;
125
- projection ?: ProjectionType < DocType > ;
126
- /**
127
- * if true, returns the full ModifyResult rather than just the document
128
- */
129
- includeResultMetadata ?: boolean ;
130
- readPreference ?: string | mongodb . ReadPreferenceMode ;
131
- /**
132
- * An alias for the `new` option. `returnOriginal: false` is equivalent to `new: true`.
133
- */
134
- returnOriginal ?: boolean ;
135
- /**
136
- * Another alias for the `new` option. `returnOriginal` is deprecated so this should be used.
137
- */
138
- returnDocument ?: 'before' | 'after' ;
139
107
/**
140
108
* Set to true to enable `update validators`
141
109
* (https://mongoosejs.com/docs/validation.html#update-validators). Defaults to false.
142
110
*/
143
111
runValidators ?: boolean ;
144
- /* Set to `true` to automatically sanitize potentially unsafe user-generated query projections */
145
- sanitizeProjection ?: boolean ;
146
112
/**
147
113
* Set to `true` to automatically sanitize potentially unsafe query filters by stripping out query selectors that
148
114
* aren't explicitly allowed using `mongoose.trusted()`.
149
115
*/
150
116
sanitizeFilter ?: boolean ;
117
+ /* Set to `true` to automatically sanitize potentially unsafe user-generated query projections */
118
+ sanitizeProjection ?: boolean ;
151
119
setDefaultsOnInsert ?: boolean ;
152
- skip ?: number ;
153
- sort ?: any ;
154
120
/** overwrites the schema's strict mode option */
155
121
strict ?: boolean | string ;
122
+
156
123
/**
157
124
* equal to `strict` by default, may be `false`, `true`, or `'throw'`. Sets the default
158
125
* [strictQuery](https://mongoosejs.com/docs/guide.html#strictQuery) mode for schemas.
159
126
*/
160
127
strictQuery ?: boolean | 'throw' ;
161
- tailable ?: number ;
162
128
/**
163
129
* If set to `false` and schema-level timestamps are enabled,
164
130
* skip timestamps for this update. Note that this allows you to overwrite
165
131
* timestamps. Does nothing if schema-level timestamps are not set.
166
132
*/
167
133
timestamps ?: boolean | QueryTimestampsConfig ;
134
+
168
135
/**
169
136
* If `true`, convert any aliases in filter, projection, update, and distinct
170
137
* to their database property names. Defaults to false.
171
138
*/
172
139
translateAliases ?: boolean ;
140
+
141
+ [ other : string ] : any ;
142
+ }
143
+
144
+ interface QueryOptions < DocType = unknown > extends
145
+ PopulateOption ,
146
+ SessionOption ,
147
+ MongooseSpecificQueryOptions {
148
+ arrayFilters ?: { [ key : string ] : any } [ ] ;
149
+ batchSize ?: number ;
150
+ bypassDocumentValidation ?: boolean ;
151
+ collation ?: mongodb . CollationOptions ;
152
+ comment ?: any ;
153
+ context ?: string ;
154
+ explain ?: mongodb . ExplainVerbosityLike ;
155
+ fields ?: any | string ;
156
+ hint ?: mongodb . Hint ;
157
+
158
+ let ?: Record < string , any > ;
159
+ limit ?: number ;
160
+ maxTimeMS ?: number ;
161
+ multi ?: boolean ;
162
+ /**
163
+ * By default, `findOneAndUpdate()` returns the document as it was **before**
164
+ * `update` was applied. If you set `new: true`, `findOneAndUpdate()` will
165
+ * instead give you the object after `update` was applied.
166
+ */
167
+ new ?: boolean ;
168
+ projection ?: ProjectionType < DocType > ;
169
+ /**
170
+ * if true, returns the full ModifyResult rather than just the document
171
+ */
172
+ includeResultMetadata ?: boolean ;
173
+ readPreference ?: string | mongodb . ReadPreferenceMode ;
174
+ /**
175
+ * An alias for the `new` option. `returnOriginal: false` is equivalent to `new: true`.
176
+ */
177
+ returnOriginal ?: boolean ;
178
+ /**
179
+ * Another alias for the `new` option. `returnOriginal` is deprecated so this should be used.
180
+ */
181
+ returnDocument ?: 'before' | 'after' ;
182
+ skip ?: number ;
183
+ sort ?: any ;
184
+
185
+ tailable ?: number ;
186
+
173
187
upsert ?: boolean ;
174
188
useBigInt64 ?: boolean ;
175
189
writeConcern ?: mongodb . WriteConcern ;
0 commit comments