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