File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -304,14 +304,17 @@ class Service extends AdapterService {
304304 if ( id !== null ) {
305305 query . $and = ( query . $and || [ ] ) . concat ( { [ this . id ] : id } ) ;
306306
307- return this . Model . findOneAndDelete ( query , params . mongoose ) . lean ( this . lean )
308- . exec ( ) . then ( result => {
307+ return this . Model . findById ( id )
308+ . then ( ( result ) => {
309309 if ( result === null ) {
310310 throw new errors . NotFound ( `No record found for id '${ id } '` , query ) ;
311311 }
312-
313- return result ;
314- } ) . then ( select ( params , this . id ) ) . catch ( errorHandler ) ;
312+ return this . Model . deleteOne ( query , params . mongoose ) . lean ( this . lean )
313+ . exec ( )
314+ . then ( ( ) => result )
315+ . then ( select ( params , this . id ) ) ;
316+ } )
317+ . catch ( errorHandler ) ;
315318 }
316319
317320 const findParams = Object . assign ( { } , params , {
You can’t perform that action at this time.
0 commit comments