@@ -309,7 +309,7 @@ operations.set('find', async ({ entities, operation }) => {
309
309
operations . set ( 'findOneAndReplace' , async ( { entities, operation } ) => {
310
310
const collection = entities . getEntity ( 'collection' , operation . object ) ;
311
311
const { filter, replacement, ...opts } = operation . arguments ;
312
- return collection . findOneAndReplace ( filter , replacement , translateOptions ( opts ) ) ;
312
+ return ( await collection . findOneAndReplace ( filter , replacement , translateOptions ( opts ) ) ) . value ;
313
313
} ) ;
314
314
315
315
operations . set ( 'findOneAndUpdate' , async ( { entities, operation } ) => {
@@ -318,6 +318,12 @@ operations.set('findOneAndUpdate', async ({ entities, operation }) => {
318
318
return ( await collection . findOneAndUpdate ( filter , update , translateOptions ( opts ) ) ) . value ;
319
319
} ) ;
320
320
321
+ operations . set ( 'findOneAndDelete' , async ( { entities, operation } ) => {
322
+ const collection = entities . getEntity ( 'collection' , operation . object ) ;
323
+ const { filter, ...opts } = operation . arguments ;
324
+ return ( await collection . findOneAndDelete ( filter , opts ) ) . value ;
325
+ } ) ;
326
+
321
327
operations . set ( 'failPoint' , async ( { entities, operation } ) => {
322
328
const client = entities . getEntity ( 'client' , operation . arguments . client ) ;
323
329
return entities . failPoints . enableFailPoint ( client , operation . arguments . failPoint ) ;
@@ -467,11 +473,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => {
467
473
return collection . estimatedDocumentCount ( operation . arguments ) ;
468
474
} ) ;
469
475
470
- operations . set ( 'findOneAndDelete' , async ( { entities, operation } ) => {
471
- const collection = entities . getEntity ( 'collection' , operation . object ) ;
472
- return collection . findOneAndDelete ( operation . arguments . filter ) ;
473
- } ) ;
474
-
475
476
operations . set ( 'runCommand' , async ( { entities, operation } : OperationFunctionParams ) => {
476
477
const db = entities . getEntity ( 'db' , operation . object ) ;
477
478
return db . command ( operation . arguments . command ) ;
0 commit comments