@@ -5,9 +5,7 @@ import { MongoDBResponse } from '../cmap/wire_protocol/responses';
55import type { Collection } from '../collection' ;
66import { MongoServerError } from '../error' ;
77import type { InferIdType } from '../mongo_types' ;
8- import type { Server } from '../sdam/server' ;
98import type { ClientSession } from '../sessions' ;
10- import { type TimeoutContext } from '../timeout' ;
119import { maybeAddIdToDocuments , type MongoDBNamespace } from '../utils' ;
1210import { type CommandOperationOptions , ModernizedCommandOperation } from './command' ;
1311import { Aspect , defineAspects } from './operation' ;
@@ -73,24 +71,6 @@ export class InsertOneOperation extends InsertOperation {
7371 super ( collection . s . namespace , [ maybeAddIdToDocuments ( collection , doc , options ) ] , options ) ;
7472 }
7573
76- override async execute (
77- server : Server ,
78- session : ClientSession | undefined ,
79- timeoutContext : TimeoutContext
80- ) : Promise < InsertOneResult > {
81- const res = await super . execute ( server , session , timeoutContext ) ;
82- if ( res . code ) throw new MongoServerError ( res ) ;
83- if ( res . writeErrors ) {
84- // This should be a WriteError but we can't change it now because of error hierarchy
85- throw new MongoServerError ( res . writeErrors [ 0 ] ) ;
86- }
87-
88- return {
89- acknowledged : this . writeConcern ?. w !== 0 ,
90- insertedId : this . documents [ 0 ] . _id
91- } ;
92- }
93-
9474 override handleOk ( response : InstanceType < typeof this . SERVER_COMMAND_RESPONSE_TYPE > ) : Document {
9575 const res = super . handleOk ( response ) ;
9676 if ( res . code ) throw new MongoServerError ( res ) ;
0 commit comments