Throw exceptions in case of single document updates
This commit is contained in:
parent
5812753217
commit
5254793767
1 changed files with 4 additions and 2 deletions
|
@ -574,8 +574,10 @@ update :: (MonadIO m)
|
||||||
=> [UpdateOption] -> Selection -> Document -> Action m ()
|
=> [UpdateOption] -> Selection -> Document -> Action m ()
|
||||||
-- ^ Update first document in selection using updater document, unless 'MultiUpdate' option is supplied then update all documents in selection. If 'Upsert' option is supplied then treat updater as document and insert it if selection is empty.
|
-- ^ Update first document in selection using updater document, unless 'MultiUpdate' option is supplied then update all documents in selection. If 'Upsert' option is supplied then treat updater as document and insert it if selection is empty.
|
||||||
update opts (Select sel col) up = do
|
update opts (Select sel col) up = do
|
||||||
_ <- update' True col [(sel, up, opts)]
|
res <- update' True col [(sel, up, opts)]
|
||||||
return ()
|
if not $ null $ writeErrors res
|
||||||
|
then liftIO $ throwIO $ WriteFailure 0 (show $ head $ writeErrors res)
|
||||||
|
else return ()
|
||||||
|
|
||||||
updateCommandDocument :: Collection -> Bool -> [Document] -> Document -> Document
|
updateCommandDocument :: Collection -> Bool -> [Document] -> Document -> Document
|
||||||
updateCommandDocument col ordered updates writeConcern =
|
updateCommandDocument col ordered updates writeConcern =
|
||||||
|
|
Loading…
Reference in a new issue