@@ -724,16 +724,15 @@ export class PostgresStorageAdapter {
724
724
}
725
725
} ) ;
726
726
}
727
+ // Return value not currently well specified.
728
+ findOneAndUpdate ( className , schema , query , update ) {
729
+ debug ( 'findOneAndUpdate' , className , query , update ) ;
730
+ return this . updateObjectsByQuery ( className , schema , query , update ) . then ( ( val ) => val [ 0 ] ) ;
731
+ }
727
732
728
733
// Apply the update to all objects that match the given Parse Query.
729
734
updateObjectsByQuery ( className , schema , query , update ) {
730
735
debug ( 'updateObjectsByQuery' , className , query , update ) ;
731
- return this . findOneAndUpdate ( className , schema , query , update ) ;
732
- }
733
-
734
- // Return value not currently well specified.
735
- findOneAndUpdate ( className , schema , query , update ) {
736
- debug ( 'findOneAndUpdate' , className , query , update ) ;
737
736
let conditionPatterns = [ ] ;
738
737
let updatePatterns = [ ] ;
739
738
let values = [ className ]
@@ -859,8 +858,7 @@ export class PostgresStorageAdapter {
859
858
860
859
let qs = `UPDATE $1:name SET ${ updatePatterns . join ( ',' ) } WHERE ${ where . pattern } RETURNING *` ;
861
860
debug ( 'update: ' , qs , values ) ;
862
- return this . _client . any ( qs , values )
863
- . then ( val => val [ 0 ] ) ; // TODO: This is unsafe, verification is needed, or a different query method;
861
+ return this . _client . any ( qs , values ) ; // TODO: This is unsafe, verification is needed, or a different query method;
864
862
}
865
863
866
864
// Hopefully, we can get rid of this. It's only used for config and hooks.
0 commit comments