mongoDB-0.6: A driver for MongoDB

Database.MongoDB.Internal.Protocol

Contents

Description

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.

Synopsis

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

data Notice Source

A notice is a message that is sent with no reply

Instances

data UpdateOption Source

Constructors

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

Constructors

SingleRemove

If set, the database will remove only the first matching document in the collection. Otherwise all matching documents will be removed

Request

data Request Source

A request is a message that is sent with a Reply returned

Constructors

Query 

Fields

qOptions :: [QueryOption]
 
qFullCollection :: FullCollection
 
qSkip :: Int32

Number of initial matching documents to skip

qBatchSize :: Int32

The number of document to return in each batch response from the server. 0 means use Mongo default. Negative means close cursor after first batch and use absolute value as batch size.

qSelector :: Document

[] = return all documents in collection

qProjector :: Document

[] = return whole document

GetMore 

Instances

Reply

data Reply Source

A reply is a message received in response to a Request

Constructors

Reply 

Fields

rResponseFlag :: Int32

0 = success, non-zero = failure

rCursorId :: CursorId

0 = cursor finished

rStartingFrom :: Int32
 
rDocuments :: [Document]
 

Instances

Authentication