@@ -755,11 +755,16 @@ type MongoQuerySelector<T extends MongoValue> = Partial<
755
755
756
756
type MongoQuery < T extends MongoObject > = { [ K in keyof T ] ?: T [ K ] | MongoQuerySelector < T [ K ] > } & { _id ?: MongoId }
757
757
758
- type MongoUpdateOperators < T extends MongoObject > = Partial < {
758
+ type MongoUpdateArrayOperatorUniversalModifiers < T > = { $each ?: T extends [ ] ? T : T [ ] }
759
+
760
+ type MongoUpdateArrayOperatorModifiers < T > = MongoUpdateArrayOperatorUniversalModifiers < T > &
761
+ { $position ?: number , $slice ?: number , $sort ?: 1 | - 1 }
762
+
763
+ type MongoUpdateCommand < T extends MongoObject > = Partial < {
759
764
/* Universal operators */
760
- $set : Partial < Record < string , MongoCommandValue > & T >
761
- $setOnInsert : Partial < Record < string , MongoCommandValue > & T >
762
- $unset : Partial < Record < string , "" > & T >
765
+ $set : Partial < Record < ( string & { } ) | keyof T , MongoCommandValue > >
766
+ $setOnInsert : Partial < Record < ( string & { } ) | keyof T , MongoCommandValue > >
767
+ $unset : Partial < Record < ( string & { } ) | keyof T , "" > >
763
768
764
769
$rename : Partial < Record < string , string > & { [ key in keyof T ] : string } >
765
770
@@ -792,13 +797,6 @@ type MongoUpdateOperators<T extends MongoObject> = Partial<{
792
797
$pullAll : Record < string , MongoCommandValue > & { [ K in keyof T as T [ K ] extends [ ] ? K : never ] ?: T [ K ] }
793
798
} >
794
799
795
- type MongoUpdateArrayOperatorUniversalModifiers < T > = { $each ?: T extends [ ] ? T : T [ ] }
796
-
797
- type MongoUpdateArrayOperatorModifiers < T > = MongoUpdateArrayOperatorUniversalModifiers < T > &
798
- { $position ?: number , $slice ?: number , $sort ?: 1 | - 1 }
799
-
800
- type MongoUpdateCommand < Schema extends MongoObject > = MongoUpdateOperators < Schema >
801
-
802
800
type SortOrder = { [ key : string ] : 1 | - 1 | SortOrder }
803
801
804
802
type Cursor < T > = {
0 commit comments