Skip to content

Commit e25bdc3

Browse files
insert
1 parent 6d52e39 commit e25bdc3

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/operations/insert.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import { MongoDBResponse } from '../cmap/wire_protocol/responses';
55
import type { Collection } from '../collection';
66
import { MongoServerError } from '../error';
77
import type { InferIdType } from '../mongo_types';
8-
import type { Server } from '../sdam/server';
98
import type { ClientSession } from '../sessions';
10-
import { type TimeoutContext } from '../timeout';
119
import { maybeAddIdToDocuments, type MongoDBNamespace } from '../utils';
1210
import { type CommandOperationOptions, ModernizedCommandOperation } from './command';
1311
import { 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

Comments
 (0)