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 and Database.MongoDB.Connection instead.
- type Pipe = Pipeline Message Response
- send :: Pipe -> [Notice] -> IOE ()
- call :: Pipe -> [Notice] -> Request -> IOE (IOE 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
Pipe
send :: Pipe -> [Notice] -> IOE ()Source
Send notices as a contiguous batch to server with no reply. Throw IOError if connection fails.
call :: Pipe -> [Notice] -> Request -> IOE (IOE 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 throw 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 | |
data QueryOption Source
TailableCursor | Tailable means cursor is not closed when the last data is retrieved. Rather, the cursor marks the final object's position. You can resume using the cursor later, from where it was located, if more data were received. Like any latent cursor, the cursor may become invalid at some point for example if the final object it references were deleted. Thus, you should be prepared to requery on CursorNotFound exception. |
SlaveOK | Allow query of replica slave. Normally these return an error except for namespace local. |
NoCursorTimeout | |
AwaitData | Use with TailableCursor. If we are at the end of the data, block for a while rather than returning no data. After a timeout period, we do return as normal. | Exhaust -- ^ Stream the data down full blast in multiple more packages, on the assumption that the client will fully read all data queried. Faster when you are pulling a lot of data and know you want to pull it all down. Note: the client is not allowed to not read all the data unless it closes the connection. |
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 | Query error. Returned with 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 |