- data Connection
- connect :: HostName -> IO Connection
- connectOnPort :: HostName -> PortID -> IO Connection
- conClose :: Connection -> IO ()
- disconnect :: Connection -> IO ()
- dropDatabase :: Connection -> Database -> IO ()
- type Database = String
- data MongoDBCollectionInvalid
- data ColCreateOpt
- collectionNames :: Connection -> Database -> IO [Collection]
- createCollection :: Connection -> Collection -> [ColCreateOpt] -> IO ()
- dropCollection :: Connection -> Collection -> IO ()
- validateCollection :: Connection -> Collection -> IO String
- type Collection = String
- type FieldSelector = [ByteString]
- type NumToSkip = Int32
- type NumToReturn = Int32
- type Selector = BsonDoc
- data QueryOpt
- data UpdateFlag
- count :: Connection -> Collection -> IO Int64
- countMatching :: Connection -> Collection -> Selector -> IO Int64
- delete :: Connection -> Collection -> Selector -> IO RequestID
- insert :: Connection -> Collection -> BsonDoc -> IO RequestID
- insertMany :: Connection -> Collection -> [BsonDoc] -> IO RequestID
- query :: Connection -> Collection -> [QueryOpt] -> NumToSkip -> NumToReturn -> Selector -> FieldSelector -> IO Cursor
- remove :: Connection -> Collection -> Selector -> IO RequestID
- update :: Connection -> Collection -> [UpdateFlag] -> Selector -> BsonDoc -> IO RequestID
- find :: Connection -> Collection -> Selector -> IO Cursor
- findOne :: Connection -> Collection -> Selector -> IO (Maybe BsonDoc)
- quickFind :: Connection -> Collection -> Selector -> IO [BsonDoc]
- quickFind' :: Connection -> Collection -> Selector -> IO [BsonDoc]
- data Cursor
- allDocs :: Cursor -> IO [BsonDoc]
- allDocs' :: Cursor -> IO [BsonDoc]
- finish :: Cursor -> IO ()
- nextDoc :: Cursor -> IO (Maybe BsonDoc)
Estabilish a connection to a MongoDB server on a non-standard port
Desired initial size for the collection (in bytes). must be less than or equal to 10000000000. For capped collections this size is the max size of the collection.
Maximum number of objects if capped.
Return a list of collections in Database.
Return a string of validation info about the collection.
Example output (note this probably can/will change with different versions of the server):
validate details: 0x7fe5cc2c1da4 ofs:e7da4 firstExtent:0:24100 ns:test.foo.bar lastExtent:0:24100 ns:test.foo.bar # extents:1 datasize?:180 nrecords?:5 lastExtentSize:1024 padding:1 first extent: loc:0:24100 xnext:null xprev:null nsdiag:test.foo.bar size:1024 firstRecord:0:241e4 lastRecord:0:24280 5 objects found, nobj:5 260 bytes data w/headers 180 bytes data wout/headers deletedList: 0100100000000000000 deleted: n: 4 size: 588 nIndexes:1 test.foo.bar.$_id_ keys:5
The full collection name. The full collection name is the
concatenation of the database name with the collection name, using
. for the concatenation. For example, for the database
and the collection
bar, the full collection name is
A list of field names that limits the fields in the returned documents. The list can contains zero or more elements, each of which is the name of a field that should be returned. An empty list means that no limiting is done and all fields are returned.
Sets the number of documents to omit - starting from the first document in the resulting dataset - when returning the result of the query.
This controls how many documents are returned at a time. The cursor works by requesting NumToReturn documents, which are then immediately all transfered over the network; these are held locally until the those NumToReturn are all consumed and then the network will be hit again for the next NumToReturn documents.
If the value
0 is given, the database will choose the number of
documents to return.
Otherwise choosing a good value is very dependant on the document size and the way the cursor is being used.
BsonDoc representing restrictions for a query much like the
where part of an SQL query.
Options that control the behavior of a
Options that effect the behavior of a
Return the number of documents in Collection matching Selector
Delete documents matching Selector from the given Collection.
Insert a single document into Collection.
Insert a list of documents into Collection.
Open a cursor to find documents in Collection that match Selector. See the documentation for each argument's type for information about how it effects the query.
Update documents with BsonDoc in Collection that match Selector.
Convience collection operations
Open a cursor to find documents. If you need full functionality,
Query, but only return the first result, if any.
Perform a query and return the result as a lazy list. Be sure to
understand the comments about using the lazy list given for
Perform a query and return the result as a strict list.
Return a lazy list of all (of the rest) of the documents in the cursor. This works much like hGetContents--it will lazily read the cursor data out of the database as the list is used. The cursor is automatically closed when the list has been fully read.
If you manually finish the cursor before consuming off this list you won't get all the original documents in the cursor.
If you don't consume to the end of the list, you must manually close the cursor or you will leak the cursor, which may also leak on the database side.
Returns a strict list of all (of the rest) of the documents in the cursor. This means that all of the documents will immediately be read out of the database and loaded into memory.