persistent-mongoDB 2.10.0.1 → 2.11.0.0
raw patch · 6 files changed
+18/−7 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Database.Persist.MongoDB: data family BackendKey backend :: Type
+ Database.Persist.MongoDB: data family BackendKey backend
- Database.Persist.MongoDB: type Action = (ReaderT MongoContext :: Type -> Type -> Type -> Type)
+ Database.Persist.MongoDB: type Action = ReaderT MongoContext
Files
- ChangeLog.md +4/−0
- Database/Persist/MongoDB.hs +7/−0
- persistent-mongoDB.cabal +3/−3
- test/EmbedTestMongo.hs +2/−2
- test/EntityEmbedTestMongo.hs +1/−1
- test/main.hs +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for persistent-mongoDB +## 2.11.0++* Naive implementation of `exists` function from `PersistQueryRead` type class using `count`. [#1131](https://github.com/yesodweb/persistent/pull/1131/files)+ ## 2.10.0.1 * Remove unnecessary deriving of Typeable [#1114](https://github.com/yesodweb/persistent/pull/1114)
Database/Persist/MongoDB.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-orphans #-}+{-# OPTIONS_GHC -fno-warn-deprecations #-} -- Pattern match 'PersistDbSpecific' -- | Use persistent-mongodb the same way you would use other persistent -- libraries and refer to the general persistent documentation. -- There are some new MongoDB specific filters under the filters section.@@ -691,6 +692,10 @@ query = DB.select (filtersToDoc filts) $ collectionName $ dummyFromFilts filts + exists filts = do+ cnt <- count filts+ pure (cnt > 0)+ -- | uses cursor option NoCursorTimeout -- If there is no sorting, it will turn the $snapshot option on -- and explicitly closes the cursor when done@@ -1043,6 +1048,8 @@ val (PersistRational _) = throw $ PersistMongoDBUnsupported "PersistRational not implemented for the MongoDB backend" val (PersistArray a) = DB.val $ PersistList a val (PersistDbSpecific _) = throw $ PersistMongoDBUnsupported "PersistDbSpecific not implemented for the MongoDB backend"+ val (PersistLiteral _) = throw $ PersistMongoDBUnsupported "PersistLiteral not implemented for the MongoDB backend"+ val (PersistLiteralEscaped _) = throw $ PersistMongoDBUnsupported "PersistLiteralEscaped not implemented for the MongoDB backend" cast' (DB.Float x) = Just (PersistDouble x) cast' (DB.Int32 x) = Just $ PersistInt64 $ fromIntegral x cast' (DB.Int64 x) = Just $ PersistInt64 x
persistent-mongoDB.cabal view
@@ -1,5 +1,5 @@ name: persistent-mongoDB-version: 2.10.0.1+version: 2.11.0.0 license: MIT license-file: LICENSE author: Greg Weber <greg@gregweber.info>@@ -22,12 +22,12 @@ build-depends: base >= 4.8 && < 5 , persistent >= 2.8 && < 3 , aeson >= 1.0- , bson >= 0.3.2 && < 0.4+ , bson >= 0.3.2 && < 0.5 , bytestring , cereal >= 0.5 , conduit >= 1.2 , http-api-data >= 0.3.7 && < 0.5- , mongoDB >= 2.3 && < 2.7+ , mongoDB >= 2.3 && < 2.8 , network >= 2.6 , path-pieces >= 0.2 , resource-pool >= 0.2 && < 0.3
test/EmbedTestMongo.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE DataKinds, ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -303,7 +303,7 @@ it "can embed an Entity" $ db $ do let foo = ARecord "foo" bar = ARecord "bar"- _ <- insertMany [foo, bar]+ insertMany_ [foo, bar] arecords <- selectList ([ARecordName ==. "foo"] ||. [ARecordName ==. "bar"]) [] length arecords @== 2
test/EntityEmbedTestMongo.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE DataKinds, ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE QuasiQuotes #-}
test/main.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE DataKinds, ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE QuasiQuotes #-}