Low-level messaging between this client and the MongoDB server. See Mongo Wire Protocol (http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol).
This module is not intended for direct use. Use the high-level interface at Database.MongoDB.Query instead.
- type Connection = Pipe Handle ByteString
- mkConnection :: Handle -> IO Connection
- send :: Connection -> [Notice] -> IO ()
- call :: Connection -> [Notice] -> Request -> IO (IO Reply)
- type FullCollection = UString
- data Notice
- = Insert { }
- | Update { }
- | Delete { }
- | KillCursors {
- kCursorIds :: [CursorId]
- data UpdateOption
- = Upsert
- | MultiUpdate
- data DeleteOption = SingleRemove
- type CursorId = Int64
- data Request
- data QueryOption
- data Reply = Reply {
- rResponseFlags :: [ResponseFlag]
- rCursorId :: CursorId
- rStartingFrom :: Int32
- rDocuments :: [Document]
- data ResponseFlag
- type Username = UString
- type Password = UString
- type Nonce = UString
- pwHash :: Username -> Password -> UString
- pwKey :: Nonce -> Username -> Password -> UString
Connection
type Connection = Pipe Handle ByteStringSource
Thread-safe TCP connection to server with pipelined requests
mkConnection :: Handle -> IO ConnectionSource
New thread-safe pipelined connection over handle
send :: Connection -> [Notice] -> IO ()Source
Send notices as a contiguous batch to server with no reply. Raise IOError if connection fails.
call :: Connection -> [Notice] -> Request -> IO (IO Reply)Source
Send notices and request as a contiguous batch to server and return reply promise, which will block when invoked until reply arrives. This call and resulting promise will raise IOError if connection fails.
Message
type FullCollection = UStringSource
Database name and collection name with period (.) in between. Eg. "myDb.myCollection"
Notice
A notice is a message that is sent with no reply
data UpdateOption Source
Upsert | If set, the database will insert the supplied object into the collection if no matching document is found |
MultiUpdate | If set, the database will update all matching objects in the collection. Otherwise only updates first matching doc |
data DeleteOption Source
SingleRemove | If set, the database will remove only the first matching document in the collection. Otherwise all matching documents will be removed |
Request
A request is a message that is sent with a Reply
returned
Query | |
| |
GetMore | |
Reply
A reply is a message received in response to a Request
Reply | |
|
data ResponseFlag Source
CursorNotFound | Set when getMore is called but the cursor id is not valid at the server. Returned with zero results. |
QueryError | Server error. Results contains one document containing an $err field holding the error message. |
AwaitCapable | For backward compatability: Set when the server supports the AwaitData query option. if it doesn't, a replica slave client should sleep a little between getMore's |