Documentation
¶
Index ¶
Constants ¶
View Source
const ( OpReplyCode = OpCode(1) OpMessageCode = OpCode(1000) OpUpdateCode = OpCode(2001) OpInsertCode = OpCode(2002) Reserved = OpCode(2003) OpQueryCode = OpCode(2004) OpGetMoreCode = OpCode(2005) OpDeleteCode = OpCode(2006) OpKillCursorsCode = OpCode(2007) )
The full set of known request op codes: http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#request-opcodes
View Source
const HeaderLen = 16
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MsgHeader ¶
type MsgHeader struct {
// MessageLength is the total message size, including this header
MessageLength int32
// RequestID is the identifier for this message
RequestID int32
// ResponseTo is the RequestID of the message being responded to. used in DB responses
ResponseTo int32
// OpCode is the request type, see consts above.
OpCode OpCode
// Message raw content
Message []byte
}
MsgHeader is the mongo MsgHeader
func (*MsgHeader) GetMsgHeader ¶
type OpCode ¶
type OpCode int32
OpCode allow identifying the type of operation:
http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#request-opcodes
func (OpCode) HasResponse ¶
HasResponse tells us if the operation will have a response from the server.
func (OpCode) IsMutation ¶
IsMutation tells us if the operation will mutate data. These operations can be followed up by a getLastErr operation.
type OpQuery ¶
type OpQuery struct {
// MsgHeader standard message header
MsgHeader *MsgHeader
// Flags bit vector of query options.
Flags int32
// FullCollectionName "dbname.collectionname"
FullCollectionName CSString
// number of documents to skip
NumberToSkip int32
// number of documents to return
NumberToReturn int32
// in the first OP_REPLY batch
Query Document
// Optional. Selector indicating the fields
ReturnFieldsSelector Document
}
MsgHeader is the mongo MsgHeader
func (*OpQuery) GetMsgHeader ¶
type OpReply ¶
type OpReply struct {
// MsgHeader standard message header
MsgHeader *MsgHeader
// ResponseFlags bit vector.
ResponseFlags int32
// CursorID cursor id if client needs to do get more's
CursorID int64
// StartingFrom where in the cursor this reply is starting
StartingFrom int32
// NumberReturned number of documents in the reply
NumberReturned int32
// Documents
Documents []Document
}
MsgHeader is the mongo MsgHeader
func NewOpReplay ¶
func (*OpReply) AddDocument ¶
type WriteError ¶
type WriteResult ¶
type WriteResult struct {
Result int32 `bson:"ok"`
InsertedCount int32 `bson:"n"`
WriteErrors []WriteError `bson:"writeErrors"`
}
Click to show internal directories.
Click to hide internal directories.