Adjust index for updateBlock results
This commit is contained in:
parent
f57ac94a3b
commit
e2e9f12af8
1 changed files with 6 additions and 8 deletions
|
@ -48,7 +48,7 @@ module Database.MongoDB.Query (
|
||||||
|
|
||||||
import Prelude hiding (lookup)
|
import Prelude hiding (lookup)
|
||||||
import Control.Exception (Exception, throwIO)
|
import Control.Exception (Exception, throwIO)
|
||||||
import Control.Monad (unless, replicateM, liftM, forM, liftM2)
|
import Control.Monad (unless, replicateM, liftM, liftM2)
|
||||||
import Data.Int (Int32, Int64)
|
import Data.Int (Int32, Int64)
|
||||||
import Data.Either (lefts, rights)
|
import Data.Either (lefts, rights)
|
||||||
import Data.List (foldl1')
|
import Data.List (foldl1')
|
||||||
|
@ -175,10 +175,8 @@ data Upserted = Upserted
|
||||||
, upsertedId :: ObjectId
|
, upsertedId :: ObjectId
|
||||||
} deriving Show
|
} deriving Show
|
||||||
|
|
||||||
data WriteConcernError = WriteConcernError
|
data WriteConcernError = WriteConcernError Int String
|
||||||
{ wceCode :: Int
|
deriving Show
|
||||||
, wceErrMsg :: String
|
|
||||||
} deriving Show
|
|
||||||
|
|
||||||
master :: AccessMode
|
master :: AccessMode
|
||||||
-- ^ Same as 'ConfirmWrites' []
|
-- ^ Same as 'ConfirmWrites' []
|
||||||
|
@ -746,7 +744,7 @@ updateBlock ordered col (prevCount, docs) = do
|
||||||
(at "nModified" doc)
|
(at "nModified" doc)
|
||||||
0
|
0
|
||||||
(map docToUpserted upsertedDocs)
|
(map docToUpserted upsertedDocs)
|
||||||
writeErrors
|
(map (addFailureIndex prevCount) writeErrors)
|
||||||
writeConcernErrors
|
writeConcernErrors
|
||||||
|
|
||||||
|
|
||||||
|
@ -890,8 +888,8 @@ delete' ordered col deleteDocs = do
|
||||||
|
|
||||||
|
|
||||||
addFailureIndex :: Int -> Failure -> Failure
|
addFailureIndex :: Int -> Failure -> Failure
|
||||||
addFailureIndex i (WriteFailure ind code s) = WriteFailure i code s
|
addFailureIndex i (WriteFailure ind code s) = WriteFailure (ind + i) code s
|
||||||
addFailureIndex i f = f
|
addFailureIndex _ f = f
|
||||||
|
|
||||||
deleteBlock :: (MonadIO m)
|
deleteBlock :: (MonadIO m)
|
||||||
=> Bool -> Collection -> (Int, [Document]) -> Action m WriteResult
|
=> Bool -> Collection -> (Int, [Document]) -> Action m WriteResult
|
||||||
|
|
Loading…
Reference in a new issue