-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Backend for the persistent library using mongoDB. -- -- MongoDB backend for the persistent library. @package persistent-mongoDB @version 1.3.2 -- | 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 collectionName :: PersistEntity record => record -> Text -- | convert a PersistEntity into document fields. unlike -- toInsertFields, nulls are included. entityToDocument :: PersistEntity record => record -> [Field] -- | Deprecated, use the better named entityToDocument -- | Deprecated: Please use entityToDocument instead 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) -- | The normal Persistent equality test (==.) is not generic enough. -- Instead use this with the drill-down operaters (->.) or (?->.) nestEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => NestedField record typ -> typ -> Filter record -- | use to see if an embedded list contains an item multiEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => EntityField record [typ] -> typ -> Filter record -- | same as nestEq, but give a BSON Value nestBsonEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => NestedField record typ -> Value -> Filter record -- | same as multiEq, but give a BSON Value multiBsonEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => EntityField record [typ] -> Value -> Filter record -- | Filter using a Regular expression. (=~.) :: (PersistEntity record, PersistEntityBackend record ~ MongoBackend) => EntityField record Text -> MongoRegex -> Filter record -- | Filter using a Regular expression against a nullable field. (?=~.) :: (PersistEntity record, PersistEntityBackend record ~ MongoBackend) => EntityField record (Maybe Text) -> MongoRegex -> Filter record -- | A MongoRegex represetns a Regular expression. It is a tuple of the -- expression and the options for the regular expression, respectively -- Options are listed here: -- http://docs.mongodb.org/manual/reference/operator/query/regex/ -- If you use the same options you may want to define a helper such as -- r t = (t, ims) type MongoRegex = (Text, Text) -- | Point to an array field with an embedded object and give a deeper -- query into the embedded object. Use with nestEq. (->.) :: PersistEntity emb => EntityField record [emb] -> EntityField emb typ -> NestedField record typ -- | Point to an array field with an embedded object and give a deeper -- query into the embedded object. This level of nesting is not the final -- level. Use ->. or &->. to point to the final -- level. (~>.) :: PersistEntity emb => EntityField record [emb] -> NestedField emb typ -> NestedField record typ -- | Same as &->., but Works against a Maybe type (?&->.) :: PersistEntity nest => EntityField record (Maybe nest) -> EntityField nest typ -> NestedField record typ -- | Same as &~>., but works against a Maybe type (?&~>.) :: PersistEntity nes1 => EntityField val (Maybe nes1) -> NestedField nes1 nes -> NestedField val nes -- | Point to a nested field to query. This field is not an array type. Use -- with nestEq. (&->.) :: PersistEntity nest => EntityField record nest -> EntityField nest typ -> NestedField record typ -- | Point to a nested field to query. This field is not an array type. -- This level of nesting is not the final level. Use ->. or -- &>. to point to the final level. (&~>.) :: PersistEntity nes1 => EntityField val nes1 -> NestedField nes1 nes -> NestedField val nes data NestedField record typ LastEmbFld :: EntityField record [emb] -> EntityField emb typ -> NestedField record typ MidEmbFld :: EntityField record [emb] -> NestedField emb typ -> NestedField record typ MidNestFlds :: EntityField record nest -> NestedField nest typ -> NestedField record typ MidNestFldsNullable :: EntityField record (Maybe nest) -> NestedField nest typ -> NestedField record typ LastNestFld :: EntityField record nest -> EntityField nest typ -> NestedField record typ LastNestFldNullable :: EntityField record (Maybe nest) -> EntityField nest typ -> NestedField record typ -- | wrapper of ObjectId -- -- data Objectid -- | like genObjectId, but for Objectid genObjectid :: IO Objectid keyToOid :: (PersistEntity entity, PersistEntityBackend entity ~ MongoBackend) => Key entity -> ObjectId oidToKey :: PersistEntity entity => ObjectId -> Key entity recordTypeFromKey :: KeyBackend MongoBackend v -> v fieldName :: PersistEntity record => EntityField record typ -> Label withConnection :: (MonadIO m, Applicative m) => MongoConf -> (ConnectionPool -> m b) -> m b 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 data MongoBackend data MongoAuth MongoAuth :: Username -> Password -> MongoAuth -- | 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 defaultMongoConf :: Text -> MongoConf defaultHost :: Text defaultAccessMode :: AccessMode defaultPoolStripes :: Int defaultConnectionIdleTime :: NominalDiffTime defaultStripeConnections :: Int -- | docker integration: change the host to the mongodb link applyDockerEnv :: MongoConf -> IO MongoConf 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 -- | 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 Typeable MongoBackend instance Show NoOrphanNominalDiffTime instance Eq NoOrphanNominalDiffTime instance Num NoOrphanNominalDiffTime instance Show NoOrphanPortID instance Eq NoOrphanPortID instance Show Objectid instance Read Objectid instance Eq Objectid instance Ord Objectid instance Show MongoAuth instance Show MongoConf 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 PersistFieldSql Objectid instance PersistField Objectid instance PathPiece (KeyBackend MongoBackend entity) instance FromJSON NoOrphanPortID instance FromJSON NoOrphanNominalDiffTime