-- 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.4.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 docToEntityEither :: PersistEntity record => Document -> Either Text (Entity record) docToEntityThrow :: (MonadIO m, PersistEntity record) => Document -> m (Entity record) -- | convert a PersistEntity into document fields. unlike -- toInsertDoc, nulls are included. entityToDocument :: PersistEntity record => record -> Document -- | convert a PersistEntity into document fields. for inserts only: nulls -- are ignored so they will be unset in the document. -- entityToDocument includes nulls toInsertDoc :: PersistEntity record => record -> Document updatesToDoc :: PersistEntity entity => [Update entity] -> Document filtersToDoc :: (PersistEntity val, PersistEntityBackend val ~ MongoBackend) => [Filter val] -> Document toUniquesDoc :: PersistEntity record => Unique record -> [Field] -- | Deprecated: Please use toInsertDoc instead toInsertFields :: PersistEntity record => record -> [Field] -- | Deprecated, use the better named entityToDocument -- | Deprecated: Please use entityToDocument instead entityToFields :: PersistEntity record => record -> [Field] -- | The normal Persistent equality test ==. is not generic enough. -- Instead use this with the drill-down arrow operaters such as -- ->. -- -- using this as the only query filter is similar to the following in the -- mongoDB shell -- --
-- db.Collection.find({"object.field": item})
--
nestEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => NestedField record typ -> typ -> Filter record
-- | Like nestEq, but for an embedded list. Checks to see if the list
-- contains an item.
--
-- In Haskell we need different equality functions for embedded fields
-- that are lists or non-lists to keep things type-safe.
--
-- using this as the only query filter is similar to the following in the
-- mongoDB shell
--
--
-- db.Collection.find({arrayField: arrayItem})
--
anyEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => EntityField record [typ] -> typ -> Filter record
-- | Deprecated: Please use anyEq instead
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 anyEq, but give a BSON Value
anyBsonEq :: (PersistField typ, PersistEntityBackend record ~ MongoBackend) => EntityField record [typ] -> Value -> Filter record
-- | Deprecated: Please use anyBsonEq instead
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
--
--