@@ -10,11 +10,9 @@ declare module 'mongoose' {
1010 * { age: { $gte: 30 } }
1111 * ```
1212 */
13- type RootFilterQuery < T > = FilterQuery < T > | Query < any , any > | Types . ObjectId ;
13+ type RootFilterQuery < T > = IsItRecordAndNotAny < T > extends true ? FilterQuery < T > | Query < any , any > | Types . ObjectId : FilterQuery < Record < string , any > > | Query < any , any > | Types . ObjectId ;
1414
15- type FilterQuery < T > = IsItRecordAndNotAny < T > extends true ?
16- ( { [ P in keyof T ] ?: Condition < T [ P ] > ; } & RootQuerySelector < T > & { _id ?: Condition < string > ; } ) :
17- FilterQuery < Record < string , any > > ;
15+ type FilterQuery < T > = ( { [ P in keyof T ] ?: Condition < T [ P ] > ; } & RootQuerySelector < T > & { _id ?: Condition < string > ; } ) ;
1816
1917 type MongooseBaseQueryOptionKeys =
2018 | 'context'
@@ -424,32 +422,17 @@ declare module 'mongoose' {
424422
425423 /** Creates a `find` query: gets a list of documents that match `filter`. */
426424 find (
427- filter : RootFilterQuery < RawDocType > ,
425+ filter ? : RootFilterQuery < RawDocType > ,
428426 projection ?: ProjectionType < RawDocType > | null ,
429427 options ?: QueryOptions < RawDocType > | null
430428 ) : QueryWithHelpers < Array < DocType > , DocType , THelpers , RawDocType , 'find' , TDocOverrides > ;
431- find (
432- filter : RootFilterQuery < RawDocType > ,
433- projection ?: ProjectionType < RawDocType > | null
434- ) : QueryWithHelpers < Array < DocType > , DocType , THelpers , RawDocType , 'find' , TDocOverrides > ;
435- find (
436- filter : RootFilterQuery < RawDocType >
437- ) : QueryWithHelpers < Array < DocType > , DocType , THelpers , RawDocType , 'find' , TDocOverrides > ;
438- find ( ) : QueryWithHelpers < Array < DocType > , DocType , THelpers , RawDocType , 'find' , TDocOverrides > ;
439429
440430 /** Declares the query a findOne operation. When executed, returns the first found document. */
441431 findOne (
442432 filter ?: RootFilterQuery < RawDocType > ,
443433 projection ?: ProjectionType < RawDocType > | null ,
444434 options ?: QueryOptions < RawDocType > | null
445435 ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
446- findOne (
447- filter ?: RootFilterQuery < RawDocType > ,
448- projection ?: ProjectionType < RawDocType > | null
449- ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
450- findOne (
451- filter ?: RootFilterQuery < RawDocType >
452- ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
453436
454437 /** Creates a `findOneAndDelete` query: atomically finds the given document, deletes it, and returns the document as it was before deletion. */
455438 findOneAndDelete (
@@ -484,13 +467,6 @@ declare module 'mongoose' {
484467 projection ?: ProjectionType < RawDocType > | null ,
485468 options ?: QueryOptions < RawDocType > | null
486469 ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
487- findById (
488- id : mongodb . ObjectId | any ,
489- projection ?: ProjectionType < RawDocType > | null
490- ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
491- findById (
492- id : mongodb . ObjectId | any
493- ) : QueryWithHelpers < DocType | null , DocType , THelpers , RawDocType , 'findOne' , TDocOverrides > ;
494470
495471 /** Creates a `findByIdAndDelete` query, filtering by the given `_id`. */
496472 findByIdAndDelete (
0 commit comments