-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Backend for the persistent library using mongoDB.
--
-- Backend for the persistent library using mongoDB. The haddocks aren't
-- building on hackage right now, but I put them up at
-- http://yesodweb.github.com/persistent/persistent-mongoDB/Database-Persist-MongoDB.html
@package persistent-mongoDB
@version 1.1.6
-- | 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. These
-- help extend your query into a nested document.
--
-- However, at some point you will find the normal Persistent APIs
-- lacking. and want lower level-level MongoDB access. There are
-- functions available to make working with the raw driver easier: they
-- are under the Entity conversion section. You should still use the same
-- connection pool that you are using for Persistent.
--
-- MongoDB is a schema-less database. The MongoDB Persistent backend does
-- not help perform migrations. Unlike SQL backends, uniqueness
-- constraints cannot be created for you. You must place a unique index
-- on unique fields.
module Database.Persist.MongoDB
-- | convert a PersistEntity into document fields. unlike
-- toInsertFields, nulls are included.
entityToFields :: PersistEntity record => record -> [Field]
-- | convert a PersistEntity into document fields. for inserts only: nulls
-- are ignored so they will be unset in the document.
-- entityToFields includes nulls
toInsertFields :: PersistEntity record => record -> [Field]
docToEntityEither :: PersistEntity record => Document -> Either Text (Entity record)
docToEntityThrow :: (MonadIO m, PersistEntity record) => Document -> m (Entity record)
-- | Point to a nested field to query. Used for the final level of nesting
-- with nestEq or other operators.
(->.) :: PersistEntity nes1 => EntityField val nes1 -> EntityField nes1 nes -> NestedField val nes
-- | Point to a nested field to query. This level of nesting is not the
-- final level. Use (->.) to point to the final level is
(~>.) :: PersistEntity nes1 => EntityField val nes1 -> NestedField nes1 nes -> NestedField val nes
-- | Same as (->.), but Works against a Maybe type
(?->.) :: PersistEntity nes1 => EntityField val (Maybe nes1) -> EntityField nes1 nes -> NestedField val nes
-- | Same as (~>.), but Works against a Maybe type
(?~>.) :: PersistEntity nes1 => EntityField val (Maybe nes1) -> NestedField nes1 nes -> NestedField val nes
-- | The normal Persistent equality test (==.) is not generic enough.
-- Instead use this with the drill-down operaters (->.) or (?->.)
nestEq :: (PersistField typ, PersistEntityBackend v ~ MongoBackend) => NestedField v typ -> typ -> Filter v
-- | use to see if an embedded list contains an item
multiEq :: (PersistField typ, PersistEntityBackend v ~ MongoBackend) => EntityField v [typ] -> typ -> Filter v
withMongoDBConn :: (MonadIO m, Applicative m) => Database -> HostName -> PortID -> Maybe MongoAuth -> NominalDiffTime -> (ConnectionPool -> m b) -> m b
withMongoDBPool :: (MonadIO m, Applicative m) => Database -> HostName -> PortID -> Maybe MongoAuth -> Int -> Int -> NominalDiffTime -> (ConnectionPool -> m b) -> m b
createMongoDBPool :: (MonadIO m, Applicative m) => Database -> HostName -> PortID -> Maybe MongoAuth -> Int -> Int -> NominalDiffTime -> m ConnectionPool
runMongoDBPool :: (MonadIO m, MonadBaseControl IO m) => AccessMode -> Action m a -> ConnectionPool -> m a
-- | use default AccessMode
runMongoDBPoolDef :: (MonadIO m, MonadBaseControl IO m) => Action m a -> ConnectionPool -> m a
type ConnectionPool = Pool Connection
data Connection
-- | Information required to connect to a mongo database
data MongoConf
MongoConf :: Text -> Text -> PortID -> Maybe MongoAuth -> AccessMode -> Int -> Int -> NominalDiffTime -> MongoConf
mgDatabase :: MongoConf -> Text
mgHost :: MongoConf -> Text
mgPort :: MongoConf -> PortID
mgAuth :: MongoConf -> Maybe MongoAuth
mgAccessMode :: MongoConf -> AccessMode
mgPoolStripes :: MongoConf -> Int
mgStripeConnections :: MongoConf -> Int
mgConnectionIdleTime :: MongoConf -> NominalDiffTime
data MongoBackend
data MongoAuth
MongoAuth :: Username -> Password -> MongoAuth
type PipePool = Pool Pipe
-- | A pool of plain MongoDB pipes. The database parameter has not yet been
-- applied yet. This is useful for switching between databases (on the
-- same host and port) Unlike the normal pool, no authentication is
-- available
createMongoDBPipePool :: (MonadIO m, Applicative m) => HostName -> PortID -> Int -> Int -> NominalDiffTime -> m PipePool
-- | run a pool created with createMongoDBPipePool
runMongoDBPipePool :: (MonadIO m, MonadBaseControl IO m) => AccessMode -> Database -> Action m a -> PipePool -> m a
keyToOid :: PersistEntity val => KeyBackend MongoBackend val -> ObjectId
oidToKey :: PersistEntity val => ObjectId -> KeyBackend MongoBackend val
-- | Either a host name e.g., "haskell.org" or a numeric host
-- address string consisting of a dotted decimal IPv4 address or an IPv6
-- address e.g., "192.168.0.1".
type HostName = String
data PortID :: *
type Database = Text
-- | A monad on top of m (which must be a MonadIO) that may access the
-- database and may fail with a DB Failure
data Action (m :: * -> *) a :: (* -> *) -> * -> *
-- | Type of reads and writes to perform
data AccessMode :: *
-- | Read-only action, reading stale data from a slave is OK.
ReadStaleOk :: AccessMode
-- | Read-write action, slave not OK, every write is fire & forget.
UnconfirmedWrites :: AccessMode
-- | Read-write action, slave not OK, every write is confirmed with
-- getLastError.
ConfirmWrites :: GetLastError -> AccessMode
-- | Same as ConfirmWrites []
master :: AccessMode
-- | Same as ReadStaleOk
slaveOk :: AccessMode
-- | Field with given label and typed value
(=:) :: Val v => Label -> v -> Field
instance Show NoOrphanNominalDiffTime
instance Eq NoOrphanNominalDiffTime
instance Num NoOrphanNominalDiffTime
instance PersistConfig MongoConf
instance Serialize ObjectId
instance Val PersistValue
instance (Applicative m, Functor m, MonadIO m, MonadBaseControl IO m) => PersistQuery (Action m)
instance (Applicative m, Functor m, MonadIO m, MonadBaseControl IO m) => PersistUnique (Action m)
instance MonadThrow m => MonadThrow (Action m)
instance (Applicative m, Functor m, MonadIO m, MonadBaseControl IO m) => PersistStore (Action m)
instance PathPiece (KeyBackend MongoBackend entity)
instance FromJSON PortID
instance FromJSON NoOrphanNominalDiffTime