@@ -93,6 +93,7 @@ import type {
9393 TODO_NODE_3286 ,
9494 UpdateFilter ,
9595 WithId ,
96+ WithoutId ,
9697 OptionalId ,
9798 Flatten
9899} from './mongo_types' ;
@@ -459,26 +460,29 @@ export class Collection<TSchema extends Document = Document> {
459460 * @param options - Optional settings for the command
460461 * @param callback - An optional callback, a Promise will be returned if none is provided
461462 */
462- replaceOne ( filter : Filter < TSchema > , replacement : TSchema ) : Promise < UpdateResult | Document > ;
463463 replaceOne (
464464 filter : Filter < TSchema > ,
465- replacement : TSchema ,
465+ replacement : WithoutId < TSchema >
466+ ) : Promise < UpdateResult | Document > ;
467+ replaceOne (
468+ filter : Filter < TSchema > ,
469+ replacement : WithoutId < TSchema > ,
466470 callback : Callback < UpdateResult | Document >
467471 ) : void ;
468472 replaceOne (
469473 filter : Filter < TSchema > ,
470- replacement : TSchema ,
474+ replacement : WithoutId < TSchema > ,
471475 options : ReplaceOptions
472476 ) : Promise < UpdateResult | Document > ;
473477 replaceOne (
474478 filter : Filter < TSchema > ,
475- replacement : TSchema ,
479+ replacement : WithoutId < TSchema > ,
476480 options : ReplaceOptions ,
477481 callback : Callback < UpdateResult | Document >
478482 ) : void ;
479483 replaceOne (
480484 filter : Filter < TSchema > ,
481- replacement : TSchema ,
485+ replacement : WithoutId < TSchema > ,
482486 options ?: ReplaceOptions | Callback < UpdateResult | Document > ,
483487 callback ?: Callback < UpdateResult | Document >
484488 ) : Promise < UpdateResult | Document > | void {
@@ -1279,26 +1283,29 @@ export class Collection<TSchema extends Document = Document> {
12791283 * @param options - Optional settings for the command
12801284 * @param callback - An optional callback, a Promise will be returned if none is provided
12811285 */
1282- findOneAndReplace ( filter : Filter < TSchema > , replacement : Document ) : Promise < ModifyResult < TSchema > > ;
12831286 findOneAndReplace (
12841287 filter : Filter < TSchema > ,
1285- replacement : Document ,
1288+ replacement : WithoutId < TSchema >
1289+ ) : Promise < ModifyResult < TSchema > > ;
1290+ findOneAndReplace (
1291+ filter : Filter < TSchema > ,
1292+ replacement : WithoutId < TSchema > ,
12861293 callback : Callback < ModifyResult < TSchema > >
12871294 ) : void ;
12881295 findOneAndReplace (
12891296 filter : Filter < TSchema > ,
1290- replacement : Document ,
1297+ replacement : WithoutId < TSchema > ,
12911298 options : FindOneAndReplaceOptions
12921299 ) : Promise < ModifyResult < TSchema > > ;
12931300 findOneAndReplace (
12941301 filter : Filter < TSchema > ,
1295- replacement : Document ,
1302+ replacement : WithoutId < TSchema > ,
12961303 options : FindOneAndReplaceOptions ,
12971304 callback : Callback < ModifyResult < TSchema > >
12981305 ) : void ;
12991306 findOneAndReplace (
13001307 filter : Filter < TSchema > ,
1301- replacement : Document ,
1308+ replacement : WithoutId < TSchema > ,
13021309 options ?: FindOneAndReplaceOptions | Callback < ModifyResult < TSchema > > ,
13031310 callback ?: Callback < ModifyResult < TSchema > >
13041311 ) : Promise < ModifyResult < TSchema > > | void {
0 commit comments