Documentation ¶
Index ¶
- Variables
- func GetCommandCollection(c Command) string
- func GetCommandDatabase(c Command) string
- func GetCommandReadPreferenceMode(c Command) string
- func Register(n string, f CommandFunc)
- type Aggregate
- type BuildInfo
- type ClusterTime
- type CollStats
- type Collation
- type Command
- type CommandCollection
- type CommandDatabase
- type CommandFunc
- type CommandReadPreference
- type Common
- type ConnectionStatus
- type Count
- type Create
- type CreateIndexes
- type CreateIndexesIndex
- type CurrentOp
- type Cursor
- type DbStats
- type Delete
- type DeleteIndexes
- type Distinct
- type Drop
- type DropDatabase
- type DropIndexes
- type EndSessions
- type Explain
- type Find
- type FindAndModify
- type FindAndModifyLegacy
- type GetMore
- type GetNonce
- type HedgeOptions
- type HostInfo
- type Insert
- type IsDBGrid
- type IsMaster
- type KillAllSessions
- type KillAllSessionsFilter
- type KillCursors
- type KillOp
- type ListCollections
- type ListDatabases
- type ListIndexes
- type Logout
- type MapReduce
- type OptionalDoc
- type Ping
- type ReadConcern
- type ReadPreference
- type SaslStart
- type ServerStatus
- type Session
- type ShardCollection
- type Update
- type UpdateStatement
- type Validate
- type WriteConcern
Constants ¶
This section is empty.
Variables ¶
var Registry = make(map[string]CommandFunc)
Functions ¶
func GetCommandCollection ¶
func GetCommandDatabase ¶
func Register ¶
func Register(n string, f CommandFunc)
Types ¶
type Aggregate ¶
type Aggregate struct { Aggregate bson.RawValue `bson:"aggregate"` // This is either a collection name or a 1 (int) to indicate a pipeline Pipeline primitive.A `bson:"pipeline"` Cursor pipeCmdCursor `bson:"cursor"` Explain *bool `bson:"explain,omitempty"` AllowDisk *bool `bson:"allowDiskUse,omitempty"` // TODO: disallow (or have option for it) MaxTimeMS *int64 `bson:"maxTimeMS,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` ReadConcern *ReadConcern `bson:"readConcern,omitempty"` Collation *Collation `bson:"collation,omitempty"` Hint interface{} `bson:"hint,omitempty"` Comment string `bson:"comment,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
func (*Aggregate) GetCollection ¶
type BuildInfo ¶
type BuildInfo struct { V int `bson:"buildinfo"` V2 int `bson:"buildInfo"` Common `bson:",inline"` }
the struct for the 'update' command.
type ClusterTime ¶
type CollStats ¶
type CollStats struct { Collection string `bson:"collStats"` Scale *int64 `bson:"scale,omitempty"` Verbose *int64 `bson:"verbose,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
func (*CollStats) GetCollection ¶
type Collation ¶
type Collation struct { Locale string `bson:"locale,omitempty"` // The locale CaseLevel bool `bson:"caseLevel,omitempty"` // The case level CaseFirst string `bson:"caseFirst,omitempty"` // The case ordering Strength int `bson:"strength,omitempty"` // The number of comparison levels to use NumericOrdering bool `bson:"numericOrdering,omitempty"` // Whether to order numbers based on numerical order and not collation order Alternate string `bson:"alternate,omitempty"` // Whether spaces and punctuation are considered base characters MaxVariable string `bson:"maxVariable,omitempty"` // Which characters are affected by alternate: "shifted" Normalization bool `bson:"normalization,omitempty"` // Causes text to be normalized into Unicode NFD Backwards bool `bson:"backwards,omitempty"` // Causes secondary differences to be considered in reverse order, as it is done in the French language }
type Command ¶
func GetCommand ¶
type CommandCollection ¶
type CommandDatabase ¶
type CommandFunc ¶
type CommandFunc func() Command
type CommandReadPreference ¶
type CommandReadPreference interface { Command GetReadPreference() *ReadPreference }
type Common ¶
type Common struct { ReadPreference *ReadPreference `bson:"$readPreference,omitempty"` Database string `bson:"$db,omitempty"` Session `bson:",inline"` }
func (*Common) GetDatabase ¶
func (*Common) GetReadPreference ¶
func (c *Common) GetReadPreference() *ReadPreference
type ConnectionStatus ¶
type ConnectionStatus struct { ConnectionStatus int `bson:"connectionStatus"` ShowPrivileges *bool `bson:"showPrivileges,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
type Count ¶
type Count struct { Collection string `bson:"count"` Query bson.D `bson:"query"` MaxTimeMS *int64 `bson:"maxTimeMS,omitempty"` Skip *int64 `bson:"skip,omitempty"` Limit *int64 `bson:"limit,omitempty"` Hint interface{} `bson:"hint,omitempty"` Collation *Collation `bson:"collation,omitempty"` ReadConcern *ReadConcern `bson:"readConcern,omitempty"` Fields bson.D `bson:"fields,omitempty"` // Mongo shell sends this for w/e reason, but can't find this in the docs anywhere Common `bson:",inline"` }
the struct for the 'update' command.
func (*Count) GetCollection ¶
type Create ¶
type Create struct { Collection string `bson:"create"` Capped *bool `bson:"capped,omitempty"` AutoIndexID *bool `bson:"autoIndexId,omitempty"` Size *int `bson:"size,omitempty"` Max *int `bson:"max,omitempty"` StorageEngine bson.D `bson:"storageEngine,omitempty"` Validator bson.D `bson:"validator,omitempty"` ValidationLevel string `bson:"validationLevel,omitempty"` ValidationAction string `bson:"validationAction,omitempty"` IndexOptionDefaults bson.D `bson:"indexOptionDefaults,omitempty"` ViewOn string `bson:"viewOn,omitempty"` Pipeline primitive.A `bson:"pipeline,omitempty"` Collation *Collation `bson:"collation,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Common `bson:",inline"` }
Create mongo command
func (*Create) GetCollection ¶
GetCollection returns the collection name for this Command
type CreateIndexes ¶
type CreateIndexes struct { Collection string `bson:"createIndexes"` Indexes []CreateIndexesIndex `bson:"indexes"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` CommitQuorum interface{} `bson:"commitQuorum,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*CreateIndexes) GetCollection ¶
func (m *CreateIndexes) GetCollection() string
type CreateIndexesIndex ¶
type CreateIndexesIndex struct { Key bson.D `bson:"key"` Name string `bson:"name"` Background *bool `bson:"background,omitempty"` Unique *bool `bson:"unique,omitempty"` PartialFilterExpression bson.D `bson:"partialFilterExpression,omitempty"` Sparse *bool `bson:"sparse,omitempty"` ExpireAfterSeconds *int `bson:"expireAfterSeconds,omitempty"` Hidden *bool `bson:"hidden,omitempty"` StorageEngine bson.D `bson:"storageEngine,omitempty"` Weights bson.D `bson:"weights,omitempty"` DefaultLanguage string `bson:"default_language,omitempty"` LanguageOverride string `bson:"language_override,omitempty"` TextIndexVersion int `bson:"textIndexVersion,omitempty"` TwoDSphereIndexVersion int `bson:"2dsphereIndexVersion,omitempty"` Bits int `bson:"bits,omitempty"` Min float64 `bson:"min,omitempty"` Max float64 `bson:"max,omitempty"` BucketSize int `bson:"bucketSize,omitempty"` Collation bson.D `bson:"collation,omitempty"` WildcardProjection bson.D `bson:"wildcardProjection,omitempty"` }
type CurrentOp ¶
type CurrentOp struct { CurrentOp interface{} `bson:"currentOp"` OwnOps *bool `bson:"$ownOps,omitempty"` All *bool `bson:"$all,omitempty"` Filter bson.D `bson:"filter,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
type Cursor ¶
type Cursor struct {
BatchSize *int32 `bson:"batchSize,omitempty"`
}
Cursor encapsulates the separate "cursor" doc found on some commands
type DbStats ¶ added in v0.0.7
type DbStats struct { DbStats int `bson:"dbstats"` Scale int `bson:"scale,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
type Delete ¶
type Delete struct { Collection string `bson:"delete"` Deletes []bson.D `bson:"deletes"` Ordered *bool `bson:"ordered,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Hint interface{} `bson:"hint,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Delete) GetCollection ¶
type DeleteIndexes ¶
type DeleteIndexes struct { Collection string `bson:"deleteIndexes"` Index interface{} `bson:"index"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*DeleteIndexes) GetCollection ¶
func (m *DeleteIndexes) GetCollection() string
type Distinct ¶
type Distinct struct { Collection string `bson:"distinct"` Collation *Collation `bson:"collation,omitempty"` Key string `bson:"key"` MaxTimeMS *int64 `bson:"maxTimeMS,omitempty"` Query bson.D `bson:"query"` ReadConcern *ReadConcern `bson:"readConcern,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
func (*Distinct) GetCollection ¶
type Drop ¶
type Drop struct { Collection string `bson:"drop"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Comment string `bson:"comment,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Drop) GetCollection ¶
type DropDatabase ¶
type DropDatabase struct { DropDatabase int `bson:"dropDatabase"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Comment string `bson:"comment,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
type DropIndexes ¶
type DropIndexes struct { Collection string `bson:"dropIndexes"` Index interface{} `bson:"index"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*DropIndexes) GetCollection ¶
func (m *DropIndexes) GetCollection() string
type EndSessions ¶
type EndSessions struct { SessionIDs []bsoncore.Document `bson:"endSessions"` Common `bson:",inline"` }
the struct for the 'update' command.
type Explain ¶
type Explain struct { Cmd Command `bson:"explain"` Verbosity string `bson:"verbosity,omitempty"` Comment string `bson:"comment,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Explain) GetCollection ¶
type Find ¶
type Find struct { Collection string `bson:"find"` Filter bson.D `bson:"filter,omitempty"` Sort bson.D `bson:"sort,omitempty"` Projection bson.D `bson:"projection,omitempty"` Min bson.D `bson:"min,omitempty"` Max bson.D `bson:"max,omitempty"` Skip *int64 `bson:"skip,omitempty"` Limit *int64 `bson:"limit,omitempty"` Tailable *bool `bson:"tailable,omitempty"` OplogReplay *bool `bson:"oplogReplay,omitempty"` // TODO Check SingleBatch *bool `bson:"singleBatch,omitempty"` NoCursorTimeout *bool `bson:"noCursorTimeout,omitempty"` // TODO: check AllowDiskUse *bool `bson:"allowDiskUse,omitempty"` // TODO: restrict usage of AllowPartialResults *bool `bson:"allowPartialResults,omitempty"` AwaitData *bool `bson:"awaitData,omitempty"` BatchSize *int32 `bson:"batchSize,omitempty"` Collation *Collation `bson:"collation,omitempty"` Comment string `bson:"comment,omitempty"` Hint interface{} `bson:"hint,omitempty"` MaxTimeMS *int64 `bson:"maxTimeMS,omitempty"` ShowRecordId *bool `bson:"showRecordId,omitempty"` ReturnKey *bool `bson:"returnKey,omitempty"` ShowRecordID *bool `bson:"showRecordID,omitempty"` ReadConcern *ReadConcern `bson:"readConcern,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
func (*Find) GetCollection ¶
type FindAndModify ¶
type FindAndModify struct { Collection string `bson:"findAndModify"` Query bson.D `bson:"query,omitempty"` Sort bson.D `bson:"sort,omitempty"` Remove *bool `bson:"remove,omitempty"` Update bson.D `bson:"update,omitempty"` New *bool `bson:"new,omitempty"` Fields bson.D `bson:"fields,omitempty"` Upsert *bool `bson:"upsert,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Collation *Collation `bson:"collation,omitempty"` ArrayFilters interface{} `bson:"arrayFilters,omitempty"` // TODO Common `bson:",inline"` }
the struct for the 'update' command.
func (*FindAndModify) GetCollection ¶
func (m *FindAndModify) GetCollection() string
type FindAndModifyLegacy ¶
type FindAndModifyLegacy struct { Collection string `bson:"findandmodify"` Query bson.D `bson:"query,omitempty"` Sort bson.D `bson:"sort,omitempty"` Remove *bool `bson:"remove,omitempty"` Update interface{} `bson:"update,omitempty"` New *bool `bson:"new,omitempty"` Fields bson.D `bson:"fields,omitempty"` Upsert *bool `bson:"upsert,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Collation *Collation `bson:"collation,omitempty"` ArrayFilters interface{} `bson:"arrayFilters,omitempty"` // TODO Common `bson:",inline"` }
TODO: find a way to combine? The only thing that changes is the tag for `collection` the struct for the 'update' command.
func (*FindAndModifyLegacy) GetCollection ¶
func (m *FindAndModifyLegacy) GetCollection() string
type GetMore ¶
type GetMore struct { CursorID int64 `bson:"getMore"` Collection string `bson:"collection"` BatchSize *int32 `bson:"batchSize,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*GetMore) GetCollection ¶
type HedgeOptions ¶
type HedgeOptions struct {
Enabled bool `bson:"enabled"`
}
type HostInfo ¶
type HostInfo struct { HostInfo interface{} `bson:"hostInfo"` Common `bson:",inline"` }
the struct for the 'update' command.
type Insert ¶
type Insert struct { Collection string `bson:"insert"` Documents []bson.D `bson:"documents"` Ordered *bool `bson:"ordered,omitempty"` //selector description.ServerSelector WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Insert) GetCollection ¶
type IsMaster ¶
type IsMaster struct { IsMaster int `bson:"isMaster"` IsMasterLegacy int `bson:"ismaster"` HelloOk bool `bson:"helloOk"` Client bson.D `bson:"client"` // TODO parse out Compression []string `bson:"compression"` HostInfo string `bson:"hostInfo"` Common `bson:",inline"` }
IsMaster mongo command
type KillAllSessions ¶
type KillAllSessions struct { KillAllSessions []KillAllSessionsFilter `bson:"killAllSessions"` Common `bson:",inline"` }
the struct for the 'find' command.
type KillAllSessionsFilter ¶
type KillCursors ¶
type KillCursors struct { Collection string `bson:"killCursors"` Cursors primitive.A `bson:"cursors"` Common `bson:",inline"` }
the struct for the 'find' command.
func (*KillCursors) GetCollection ¶
func (m *KillCursors) GetCollection() string
type KillOp ¶
type KillOp struct { KillOp int `bson:"killOp"` OpID int `bson:"op"` Comment string `bson:"comment,omitempty"` Common `bson:",inline"` }
the struct for the 'find' command.
type ListCollections ¶
type ListCollections struct { ListCollections int `bson:"listCollections"` Filter bson.D `bson:"filter,omitempty"` NameOnly *bool `bson:"nameOnly,omitempty"` AuthorizedDatabases *bool `bson:"authorizedDatabases,omitempty"` AuthorizedCollections *bool `bson:"authorizedCollections,omitempty"` MaxTimeMS *int64 `bson:"maxTimeMS,omitempty"` Common `bson:",inline"` *Cursor `bson:"cursor,omitempty"` }
the struct for the 'update' command.
type ListDatabases ¶
type ListDatabases struct { ListDatabases int `bson:"listDatabases"` Filter bson.D `bson:"filter,omitempty"` NameOnly *bool `bson:"nameOnly,omitempty"` AuthorizedDatabases *bool `bson:"authorizedDatabases,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
type ListIndexes ¶
type ListIndexes struct { Collection string `bson:"listIndexes"` Common `bson:",inline"` *Cursor `bson:"cursor,omitempty"` }
the struct for the 'update' command.
func (*ListIndexes) GetCollection ¶
func (m *ListIndexes) GetCollection() string
type MapReduce ¶
type MapReduce struct { // TODO: split types? Collection string `bson:"mapReduce,omitempty"` CollectionLegacy string `bson:"mapreduce,omitempty"` Map interface{} `bson:"map"` Reduce interface{} `bson:"reduce"` Out interface{} `bson:"out"` Query bson.D `bson:"query,omitempty"` Sort bson.D `bson:"sort,omitempty"` Limit *int64 `bson:"limit,omitempty"` Finalize interface{} `bson:"finalize,omitempty"` Scope bson.D `bson:"scope,omitempty"` JSMode *bool `bson:"jsMode,omitempty"` Verbose *bool `bson:"verbose,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` Collation *Collation `bson:"collation,omitempty"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Comment string `bson:"comment,omitempty"` Common `bson:",inline"` }
MapReduce mongo command
func (*MapReduce) GetCollection ¶
GetCollection returns the collection name for this Command
type OptionalDoc ¶
TODO: add IsZero to bson.D ? OptionalDoc is a document that is optional but allowed to be empty (by default an empty bson.D is omitempty-able)
func (*OptionalDoc) IsZero ¶
func (t *OptionalDoc) IsZero() bool
type ReadConcern ¶
type ReadConcern struct {
Level string `bson:"level,omitempty"`
}
type ReadPreference ¶
type ReadPreference struct { Mode string `bson:"mode"` TagSet bson.A `bson:"tagSet,omitempty"` HedgeOptions `bson:"hedgeOptions,omitempty"` }
type SaslStart ¶
type SaslStart struct { SaslStart int `bson:"saslStart"` Mechanism string `bson:"mechanism"` Payload []byte `bson:"payload"` AutoAuthorize int `bson:"autoAuthorize,omitempty"` Options bson.D `bson:"options,omitempty"` // TODO: expand Common `bson:",inline"` }
the struct for the 'find' command.
type ServerStatus ¶
the struct for the 'update' command.
type Session ¶
type Session struct { LSID bson.D `bson:"lsid,omitempty"` TxnNumber *int64 `bson:"txnNumber,omitempty"` StmtIDs []int32 `bson:"stmtIds,omitempty"` ClusterTime *ClusterTime `bson:"$clusterTime,omitempty"` }
func (*Session) GetSession ¶
type ShardCollection ¶
type ShardCollection struct { Collection string `bson:"shardCollection"` Key bson.D `bson:"key"` Unique *bool `bson:"unique,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*ShardCollection) GetCollection ¶
func (m *ShardCollection) GetCollection() string
type Update ¶
type Update struct { Collection string `bson:"update"` Updates []UpdateStatement `bson:"updates"` WriteConcern *WriteConcern `bson:"writeConcern,omitempty"` Ordered *bool `bson:"ordered,omitempty"` BypassDocumentValidation *bool `bson:"bypassDocumentValidation,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Update) GetCollection ¶
type UpdateStatement ¶
type UpdateStatement struct { Query bson.D `bson:"q"` U bson.D `bson:"u"` Upsert *bool `bson:"upsert,omitempty"` Multi *bool `bson:"multi,omitempty"` Collation *Collation `bson:"collation,omitempty"` ArrayFilters interface{} `bson:"arrayFilters,omitempty"` // TODO Hint interface{} `bson:"hint,omitempty"` }
type Validate ¶
type Validate struct { Collection string `bson:"validate"` Full *bool `bson:"full,omitempty"` Common `bson:",inline"` }
the struct for the 'update' command.
func (*Validate) GetCollection ¶
type WriteConcern ¶
Source Files ¶
- aggregate.go
- buildinfo.go
- collation.go
- collstats.go
- concern.go
- connectionstatus.go
- count.go
- create.go
- createindexes.go
- currentop.go
- dbstats.go
- delete.go
- deleteindexes.go
- distinct.go
- drop.go
- dropdatabase.go
- dropindexes.go
- endsesions.go
- explain.go
- find.go
- findandmodify.go
- getmore.go
- getnonce.go
- hostinfo.go
- insert.go
- interface.go
- isMaster.go
- isdbgrid.go
- killallsessions.go
- killcursors.go
- killop.go
- listcollections.go
- listdatabases.go
- listindexes.go
- logout.go
- mapreduce.go
- ping.go
- registry.go
- saslstart.go
- serverstatus.go
- shardcollection.go
- type.go
- update.go
- util.go
- validate.go