f_`7      !"#$%&'()*+,-./0123456 Type corresponding to the "_id" field of a document in a  structured object. ?Structured class used to convert between a Haskell record type  and BSON document. %Collection name is then name of type  Convert record to a BSON object Convert BSON object to record The "_id" field is unset.  Check if the "_id" field is unset. Get the "_id"! field (assumes that it is set0. Set the "_id" field.    A7An ordering expression 89 A query expression. :;<=>?@<Nested fields (used for extracting the names of fields in a  nested record). A 'Class defining a selectable type. Type a corresponds to the  record type, f( corresponds to the field or facet, and t  corresponds to the field/ facet type. (Given facet, return the BSON field name  Analog to mongoDB's Select class /Create a selection or query from an expression  Wrapper for mongoDB's Query type. BCActual query. #Number of matching objects to skip  (default: 0). $Maximum number of objects to return  (default: 0, no limit). Sortresult by this order.  Wrapper for mongoDB's  Selection type. DE Wrapper for mongoDB's Cursor. FG<Inserts document to its corresponding collection and return  the "_id" value. Same as  but discarding result. ?Inserts documents to their corresponding collection and return  their "_id" values. Same as  but discarding result. ?Inserts documents to their corresponding collection and return  their "_id" values. Unlike , this function keeps 8 inserting remaining documents even if an error occurs. Same as  but discarding result. H3Helper function that carries out the hard work for   and . $Save document to collection. If the  field is set then : the document is updated, otherwise we perform an insert. -Delete all documents that match the selection/query. 3Delete the first documents that match the selection/query.  Find documents satisfying query  Find documents satisfying query !Same as   but throws I if none match. ",Count number of documents satisfying query. #+Return next batch of structured documents. $2Return next structured document. If failed return J,  otherwise K of the deserialized result. %Return up to next N documents. &0Return the remaining documents in query result. 'Close the cursor. (Check if the cursor is closed. L)&Combining two field names to create a A@ type. *Combinator for == +Combinator for == ,Combinator for $ne -Combinator for < .Combinator for <= /Combinator for > 0Combinator for >= 1Combinator for $and 2Combinator for $or 3Combinator for $not M Convert a query expression to a Selector. NConvert query expression to  Selection. 4Sort by field, ascending 5Sort by field, descending OConvert a list of OrderExp to a mongoDB Order GPQRSTUVWXYZ[\I]^_`abcdefghi  !"#$%&'()*+,-./012345/45 !" ) *+,-./0123'(#$%&+   !"#$%&'()*+,-./012345mjklmnopqrstuvwxyz{|PQRSTUVWXYZ[\I]^_`abcdefg}hi~  !"#$%&'()*+,-./0123456This function generates  and Val instances for  record types. Generate the declaration for . Suppose we have  - data User = User { userId :: SObjId - , userFirstName :: String - , userLastName :: String  } This function generates:  5 toBSON x = [ (u "_id") := val (userId x) < , (u "userFirstName") := val (userFirstName x) ; , (u "userLastName") := val (userLastName x)  ] The _id" is created only if userId is not .  toSBSON Name List of field Names  SObjId Name toBSON declaration Generate the declaration for  collection Name Name of type constructor collection delclaration fromSBSON Name Name of type constructor List of field Names  SObjId name fromBSON declaration )This function generates the body for the  function  Suppose we have  - data User = User { userId :: SObjId - , userFirstName :: String - , userLastName :: String  } Given the constructor name (User), field names, a document  expression (e.g., doc3), and empty accumulator, this function generates: @ fromBSON doc = lookup (u "_id") doc >>= \val_1 -> @ lookup (u "userFirstName") doc >>= \val_2 -> @ lookup (u "userLastName") doc >>= \val_3 -> 5 return User { userId = val_1 5 , userFirstName = val_2 5 , userLastname = val_3  } BSON')s lookup with Maybe as underlying monad. 5Lookup _id. If not found, do not fail. Rather return . Constructor name  Field names Document expression 'Record field name, variable name pairs  SObjId name Record with fields set .Given name of type, generate instance for BSON's Val class. BGiven name of type, and fields, generate new type corrsponding to ' each field and make them instances of  Selectable.  Suppose we have  - data User = User { userId :: SObjId - , userFirstName :: String - , userLastName :: String  } ;This fucntion generates the following types and instances: + data UserId = UserId deriving (Show, Eq) = instance Selectable User UserId SObjId where s _ _ = "_id"  1 data FirstName = FirstName deriving (Show, Eq) F instance Selectable User FirstName String where s _ _ = "firstName"  / data LastName = LastName deriving (Show, Eq) D instance Selectable User LastName String where s _ _ = "lastName" AGiven name of type, and field, generate new type corrsponding to & the field and make it an instance of  Selectable. 666      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFFGHIJKLMNOPNOQRSTUKLVKLWKLXKLYKLZKL[KL\KL]KL^KL_KL`KLaKLbKLcKLdKLeKLfKLgKLhKLiKLjKLkKLlKLmKnoKnpKqrKqsKqtKquKqvKqwKqxKqyKqzKq{Kq|Kq}Kq~KqKqKqKqKqKqKnKKKKstructured-mongoDB-0.1!Database.MongoDB.Structured.Query!Database.MongoDB.Structured.Types'Database.MongoDB.Structured.Deriving.THDatabase.MongoDB.Structured bson-0.1.6 Data.BsonValueSObjId Structured collectiontoBSONfromBSONnoSObjId isNoSObjIdunSObjIdtoSObjIdQueryExp SelectablesStructuredSelectselectStructuredQueryskiplimitsortStructuredSelectionStructuredCursorinsertinsert_ insertMany insertMany_ insertAll insertAll_savedelete deleteOnefindfindOnefetchcount nextBatchnextnextNrest closeCursorisCursorClosed.!.*.==./=.<.<=.>.>=.&&.||not_ascdescderiveStructuredOrderExpAscDescNotExpOrExpAndExpLBinExpEqExpStarExpNested selectionunStructuredSelectionunStructuredCursorinsertManyOrAll mongoDB-1.1.1Database.MongoDB.Query DocNotFoundbase Data.EitherLeftRightunStructuredQuery expToSelectorexpToSelection expToOrderauthuseDb thisDatabase allDatabases accessModeslaveOkmasteraccessActionConnectionFailureCursorNotFoundFailure QueryFailure WriteFailureFailure ErrorCode ReadStaleOkUnconfirmedWrites ConfirmWrites AccessMode GetLastErrorliftDB BaseMonadMonadDBDatabase"Database.MongoDB.Internal.ProtocolUsernamePasswordDatabase.MongoDB.Connection secondaryOkprimarycloseReplicaSetopenReplicaSet'openReplicaSet replSetNameconnect'connectglobalConnectTimeout readHostPort readHostPortM showHostPorthost defaultPortHostSecsReplicaSetName ReplicaSetPipeSystem.IO.PipelineisClosedcloseIOEDatabase.MongoDB.Internal.UtilrunIOEnetwork-2.3.0.8NetworkPortID UnixSocket PortNumberServiceT3T2T1 funD_toBSONfunD_collection funD_fromBSONlookup_m lookup_id gen_fromBSONgen_ValInstance genSelectablegenSelectable'