Enum mongodb::wire_protocol::operations::Message
[−]
[src]
pub enum Message { OpReply { header: Header, flags: OpReplyFlags, cursor_id: i64, starting_from: i32, number_returned: i32, documents: Vec<Document>, }, OpUpdate { header: Header, namespace: String, flags: OpUpdateFlags, selector: Document, update: Document, }, OpInsert { header: Header, flags: OpInsertFlags, namespace: String, documents: Vec<Document>, }, OpQuery { header: Header, flags: OpQueryFlags, namespace: String, number_to_skip: i32, number_to_return: i32, query: Document, return_field_selector: Option<Document>, }, OpGetMore { header: Header, namespace: String, number_to_return: i32, cursor_id: i64, }, }
Represents a message in the MongoDB Wire Protocol.
Variants
OpReply
Fields
header: Header | The message header. |
flags: OpReplyFlags | A Bit vector of reply options. |
cursor_id: i64 | Uniquely identifies the cursor being returned. |
starting_from: i32 | The starting position for the cursor. |
number_returned: i32 | The total number of documents being returned. |
documents: Vec<Document> | The documents being returned. |
OpUpdate
Fields
header: Header | The message header. |
namespace: String | The full qualified name of the collection, beginning with the database name and a dot separator. |
flags: OpUpdateFlags | A bit vector of update options. |
selector: Document | Identifies the document(s) to be updated. |
update: Document | Instruction document for how to update the document(s). |
OpInsert
Fields
header: Header | The message header. |
flags: OpInsertFlags | A bit vector of insert options. |
namespace: String | The full qualified name of the collection, beginning with the database name and a dot separator. |
documents: Vec<Document> | The documents to be inserted. |
OpQuery
Fields
header: Header | The message header. |
flags: OpQueryFlags | A bit vector of query options. |
namespace: String | The full qualified name of the collection, beginning with the database name and a dot separator. |
number_to_skip: i32 | The number of initial documents to skip over in the query results. |
number_to_return: i32 | The total number of documents that should be returned by the query. |
query: Document | Specifies which documents to return. |
return_field_selector: Option<Document> | An optional projection of which fields should be present in the documents to be returned by the query. |
OpGetMore
Fields
header: Header | The message header. |
namespace: String | The full qualified name of the collection, beginning with the database name and a dot separator. |
number_to_return: i32 | The total number of documents that should be returned by the query. |
cursor_id: i64 | Uniquely identifies the cursor being returned. |
Methods
impl Message
[src]
fn new_update(request_id: i32,
namespace: String,
flags: OpUpdateFlags,
selector: Document,
update: Document)
-> Result<Message>
namespace: String,
flags: OpUpdateFlags,
selector: Document,
update: Document)
-> Result<Message>
Constructs a new message for an update.
fn new_insert(request_id: i32,
flags: OpInsertFlags,
namespace: String,
documents: Vec<Document>)
-> Result<Message>
flags: OpInsertFlags,
namespace: String,
documents: Vec<Document>)
-> Result<Message>
Constructs a new message request for an insertion.
fn new_query(request_id: i32,
flags: OpQueryFlags,
namespace: String,
number_to_skip: i32,
number_to_return: i32,
query: Document,
return_field_selector: Option<Document>)
-> Result<Message>
flags: OpQueryFlags,
namespace: String,
number_to_skip: i32,
number_to_return: i32,
query: Document,
return_field_selector: Option<Document>)
-> Result<Message>
Constructs a new message request for a query.
fn new_get_more(request_id: i32,
namespace: String,
number_to_return: i32,
cursor_id: i64)
-> Message
namespace: String,
number_to_return: i32,
cursor_id: i64)
-> Message
Constructs a new "get more" request message.
fn write_update<W: Write>(buffer: &mut W,
header: &Header,
namespace: &str,
flags: &OpUpdateFlags,
selector: &Document,
update: &Document)
-> Result<()>
header: &Header,
namespace: &str,
flags: &OpUpdateFlags,
selector: &Document,
update: &Document)
-> Result<()>
Writes a serialized update message to a given buffer.
Arguments
buffer
- The buffer to write to.
header
- The header for the given message.
namespace
- The full qualified name of the collection, beginning with
the database name and a dot.
flags
- Bit vector of query option.
selector
- Identifies the document(s) to be updated.
update
- Instructs how to update the document(s).
Return value
Returns nothing on success, or an Error on failure.
fn write_get_more<W: Write>(buffer: &mut W,
header: &Header,
namespace: &str,
number_to_return: i32,
cursor_id: i64)
-> Result<()>
header: &Header,
namespace: &str,
number_to_return: i32,
cursor_id: i64)
-> Result<()>
Writes a serialized "get more" request to a given buffer.
Arguments
buffer
- The buffer to write to.
header
- The header for the given message.
namespace
- The full qualified name of the collection, beginning with
the database name and a dot.
number_to_return - The total number of documents that should be returned by the query.
cursor_id` - Specifies which cursor to get more documents from.
Return value
Returns nothing on success, or an Error on failure.
fn write<W: Write>(&self, buffer: &mut W) -> Result<()>
Attemps to write the serialized message to a buffer.
Arguments
buffer
- The buffer to write to.
Return value
Returns nothing on success, or an error string on failure.
fn read<T>(buffer: &mut T) -> Result<Message> where T: Read + Write
Attempts to read a serialized reply Message from a buffer.
Arguments
buffer
- The buffer to read from.
Return value
Returns the reply message on success, or an Error on failure.