Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

collect ids from insert lazily in case not used

  • Loading branch information...
commit 4307fea5aa7bf2164a48f14770e6ae7054d61a62 1 parent 35801ef
Tony Hannan authored
Showing with 3 additions and 3 deletions.
  1. +2 −2 Database/MongoDB/Query.hs
  2. +1 −1  mongoDB.cabal
View
4 Database/MongoDB/Query.hs
@@ -40,7 +40,7 @@ module Database.MongoDB.Query (
import Prelude as X hiding (lookup)
import Data.UString as U (UString, dropWhile, any, tail)
-import Data.Bson (Document, at, lookup, look, Field(..), (=:), (=?), Label, Value(String,Doc), Javascript, genObjectId)
+import Data.Bson (Document, at, valueAt, lookup, look, Field(..), (=:), (=?), Label, Value(String,Doc), Javascript, genObjectId)
import Database.MongoDB.Internal.Protocol (Pipe, Notice(..), Request(GetMore), Reply(..), QueryOption(..), ResponseFlag(..), InsertOption(..), UpdateOption(..), DeleteOption(..), CursorId, FullCollection, Username, Password, pwKey)
import qualified Database.MongoDB.Internal.Protocol as P (send, call, Request(Query))
import Database.MongoDB.Internal.Util (MonadIO', loop, liftIOE, true1, (<.>))
@@ -274,7 +274,7 @@ insert' opts col docs = do
db <- thisDatabase
docs' <- liftIO $ mapM assignId docs
write (Insert (db <.> col) opts docs')
- mapM (look "_id") docs'
+ return $ map (valueAt "_id") docs'
assignId :: Document -> IO Document
-- ^ Assign a unique value to _id field if missing
View
2  mongoDB.cabal
@@ -1,5 +1,5 @@
name: mongoDB
-version: 1.0.1
+version: 1.0.2
build-type: Simple
license: OtherLicense
license-file: LICENSE
Please sign in to comment.
Something went wrong with that request. Please try again.