packages feed

mongoDB 2.3.0.2 → 2.3.0.3

raw patch · 3 files changed

+26/−4 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Database.MongoDB.Query: AggregateConfig :: AggregateConfig
+ Database.MongoDB.Query: aggregateCursor :: MonadIO m => Collection -> Pipeline -> AggregateConfig -> Action m Cursor
+ Database.MongoDB.Query: data AggregateConfig
+ Database.MongoDB.Query: instance Data.Default.Class.Default Database.MongoDB.Query.AggregateConfig
+ Database.MongoDB.Query: instance GHC.Show.Show Database.MongoDB.Query.AggregateConfig

Files

CHANGELOG.md view
@@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Package Versioning Policy](https://wiki.haskell.org/Package_versioning_policy). +## [2.3.0.3] - 2018-02-10++### Fixed+- aggregate requires cursor in mongo 3.6+ ## [2.3.0.2] - 2018-01-28  ### Fixed
Database/MongoDB/Query.hs view
@@ -35,7 +35,7 @@     -- *** Cursor     Cursor, nextBatch, next, nextN, rest, closeCursor, isCursorClosed,     -- ** Aggregate-    Pipeline, aggregate,+    Pipeline, AggregateConfig(..), aggregate, aggregateCursor,     -- ** Group     Group(..), GroupKey(..), group,     -- ** MapReduce@@ -49,6 +49,7 @@ import Prelude hiding (lookup) import Control.Exception (Exception, throwIO) import Control.Monad (unless, replicateM, liftM, liftM2)+import Data.Default.Class (Default(..)) import Data.Int (Int32, Int64) import Data.Either (lefts, rights) import Data.List (foldl1')@@ -1307,9 +1308,25 @@ aggregate :: MonadIO m => Collection -> Pipeline -> Action m [Document] -- ^ Runs an aggregate and unpacks the result. See <http://docs.mongodb.org/manual/core/aggregation/> for details. aggregate aColl agg = do-    response <- runCommand ["aggregate" =: aColl, "pipeline" =: agg]+    aggregateCursor aColl agg def >>= rest++data AggregateConfig = AggregateConfig {}+                       deriving Show++instance Default AggregateConfig where+  def = AggregateConfig {}++aggregateCursor :: MonadIO m => Collection -> Pipeline -> AggregateConfig -> Action m Cursor+-- ^ Runs an aggregate and unpacks the result. See <http://docs.mongodb.org/manual/core/aggregation/> for details.+aggregateCursor aColl agg _ = do+    response <- runCommand ["aggregate" =: aColl, "pipeline" =: agg, "cursor" =: ([] :: Document)]     case true1 "ok" response of-        True  -> lookup "result" response+        True  -> do+          cursor :: Document <- lookup "cursor" response+          firstBatch :: [Document] <- lookup "firstBatch" cursor+          cursorId :: Int64 <- lookup "id" cursor+          db <- thisDatabase+          newCursor db aColl 0 $ return $ Batch Nothing cursorId  firstBatch         False -> liftIO $ throwIO $ AggregateFailure $ at "errmsg" response  -- ** Group
mongoDB.cabal view
@@ -1,5 +1,5 @@ Name:           mongoDB-Version:        2.3.0.2+Version:        2.3.0.3 Synopsis:       Driver (client) for MongoDB, a free, scalable, fast, document                 DBMS Description:    This package lets you connect to MongoDB servers and