@@ -309,7 +309,7 @@ operations.set('find', async ({ entities, operation }) => {
309309operations . set ( 'findOneAndReplace' , async ( { entities, operation } ) => {
310310 const collection = entities . getEntity ( 'collection' , operation . object ) ;
311311 const { filter, replacement, ...opts } = operation . arguments ;
312- return collection . findOneAndReplace ( filter , replacement , translateOptions ( opts ) ) ;
312+ return ( await collection . findOneAndReplace ( filter , replacement , translateOptions ( opts ) ) ) . value ;
313313} ) ;
314314
315315operations . set ( 'findOneAndUpdate' , async ( { entities, operation } ) => {
@@ -318,6 +318,12 @@ operations.set('findOneAndUpdate', async ({ entities, operation }) => {
318318 return ( await collection . findOneAndUpdate ( filter , update , translateOptions ( opts ) ) ) . value ;
319319} ) ;
320320
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+
321327operations . set ( 'failPoint' , async ( { entities, operation } ) => {
322328 const client = entities . getEntity ( 'client' , operation . arguments . client ) ;
323329 return entities . failPoints . enableFailPoint ( client , operation . arguments . failPoint ) ;
@@ -467,11 +473,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => {
467473 return collection . estimatedDocumentCount ( operation . arguments ) ;
468474} ) ;
469475
470- operations . set ( 'findOneAndDelete' , async ( { entities, operation } ) => {
471- const collection = entities . getEntity ( 'collection' , operation . object ) ;
472- return collection . findOneAndDelete ( operation . arguments . filter ) ;
473- } ) ;
474-
475476operations . set ( 'runCommand' , async ( { entities, operation } : OperationFunctionParams ) => {
476477 const db = entities . getEntity ( 'db' , operation . object ) ;
477478 return db . command ( operation . arguments . command ) ;
0 commit comments