command

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

command

This package contains the various commands for mongo.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Registry = make(map[string]CommandFunc)

Functions

func GetCommandCollection

func GetCommandCollection(c Command) string

func GetCommandDatabase

func GetCommandDatabase(c Command) string

func GetCommandReadPreferenceMode

func GetCommandReadPreferenceMode(c Command) string

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) FromBSOND

func (m *Aggregate) FromBSOND(d bson.D) error

func (*Aggregate) GetCollection

func (a *Aggregate) GetCollection() string

type BuildInfo

type BuildInfo struct {
	V  int `bson:"buildinfo"`
	V2 int `bson:"buildInfo"`

	Common `bson:",inline"`
}

the struct for the 'update' command.

func (*BuildInfo) FromBSOND

func (m *BuildInfo) FromBSOND(d bson.D) error

type ClusterTime

type ClusterTime struct {
	ClusterTime primitive.Timestamp `bson:"clusterTime,omitempty"`
	Signature   bson.Raw            `bson:"signature,omitempty"`
}

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) FromBSOND

func (m *CollStats) FromBSOND(d bson.D) error

func (*CollStats) GetCollection

func (m *CollStats) GetCollection() string

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

type Command interface {
	GetSession() *Session
	FromBSOND(d bson.D) error
}

func GetCommand

func GetCommand(d string) (Command, bool)

type CommandCollection

type CommandCollection interface {
	Command
	GetCollection() string
}

type CommandDatabase

type CommandDatabase interface {
	Command
	GetDatabase() string
}

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 (c *Common) GetDatabase() string

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.

func (*ConnectionStatus) FromBSOND

func (m *ConnectionStatus) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Count) FromBSOND(d bson.D) error

func (*Count) GetCollection

func (m *Count) GetCollection() string

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) FromBSOND

func (m *Create) FromBSOND(d bson.D) error

From BSOND loads a command from a bson.D

func (*Create) GetCollection

func (m *Create) GetCollection() string

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) FromBSOND

func (m *CreateIndexes) FromBSOND(d bson.D) error

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.

func (*CurrentOp) FromBSOND

func (m *CurrentOp) FromBSOND(d bson.D) error

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.

func (*DbStats) FromBSOND added in v0.0.7

func (m *DbStats) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Delete) FromBSOND(d bson.D) error

func (*Delete) GetCollection

func (m *Delete) GetCollection() string

type DeleteIndexes

type DeleteIndexes struct {
	Collection string      `bson:"deleteIndexes"`
	Index      interface{} `bson:"index"`

	Common `bson:",inline"`
}

the struct for the 'update' command.

func (*DeleteIndexes) FromBSOND

func (m *DeleteIndexes) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Distinct) FromBSOND(d bson.D) error

func (*Distinct) GetCollection

func (m *Distinct) GetCollection() string

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) FromBSOND

func (m *Drop) FromBSOND(d bson.D) error

func (*Drop) GetCollection

func (m *Drop) GetCollection() string

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.

func (*DropDatabase) FromBSOND

func (m *DropDatabase) FromBSOND(d bson.D) error

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) FromBSOND

func (m *DropIndexes) FromBSOND(d bson.D) error

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.

func (*EndSessions) FromBSOND

func (m *EndSessions) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Explain) FromBSOND(d bson.D) error

func (*Explain) GetCollection

func (m *Explain) GetCollection() string

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) FromBSOND

func (m *Find) FromBSOND(d bson.D) error

func (*Find) GetCollection

func (m *Find) GetCollection() string

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) FromBSOND

func (m *FindAndModify) FromBSOND(d bson.D) error

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) FromBSOND

func (m *FindAndModifyLegacy) FromBSOND(d bson.D) error

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) FromBSOND

func (m *GetMore) FromBSOND(d bson.D) error

func (*GetMore) GetCollection

func (m *GetMore) GetCollection() string

type GetNonce

type GetNonce struct {
	GetNonce int `bson:"getnonce"`

	Common `bson:",inline"`
}

the struct for the 'find' command.

func (*GetNonce) FromBSOND

func (m *GetNonce) FromBSOND(d bson.D) error

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.

func (*HostInfo) FromBSOND

func (m *HostInfo) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Insert) FromBSOND(d bson.D) error

func (*Insert) GetCollection

func (m *Insert) GetCollection() string

type IsDBGrid

type IsDBGrid struct {
	IsDBGrid int `bson:"isdbgrid"`

	Common `bson:",inline"`
}

the struct for the 'find' command.

func (*IsDBGrid) FromBSOND

func (m *IsDBGrid) FromBSOND(d bson.D) error

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

func (*IsMaster) FromBSOND

func (m *IsMaster) FromBSOND(d bson.D) error

From BSOND loads a command from a bson.D

type KillAllSessions

type KillAllSessions struct {
	KillAllSessions []KillAllSessionsFilter `bson:"killAllSessions"`

	Common `bson:",inline"`
}

the struct for the 'find' command.

func (*KillAllSessions) FromBSOND

func (m *KillAllSessions) FromBSOND(d bson.D) error

type KillAllSessionsFilter

type KillAllSessionsFilter struct {
	User string `bson:"user,omitempty"`
	DB   string `bson:"db,omitempty"`
}

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) FromBSOND

func (m *KillCursors) FromBSOND(d bson.D) error

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.

func (*KillOp) FromBSOND

func (m *KillOp) FromBSOND(d bson.D) error

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.

func (*ListCollections) FromBSOND

func (m *ListCollections) FromBSOND(d bson.D) error

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.

func (*ListDatabases) FromBSOND

func (m *ListDatabases) FromBSOND(d bson.D) error

type ListIndexes

type ListIndexes struct {
	Collection string `bson:"listIndexes"`

	Common  `bson:",inline"`
	*Cursor `bson:"cursor,omitempty"`
}

the struct for the 'update' command.

func (*ListIndexes) FromBSOND

func (m *ListIndexes) FromBSOND(d bson.D) error

func (*ListIndexes) GetCollection

func (m *ListIndexes) GetCollection() string

type Logout

type Logout struct {
	Logout int `bson:"logout"`

	Common `bson:",inline"`
}

the struct for the 'logout' command.

func (*Logout) FromBSOND

func (m *Logout) FromBSOND(d bson.D) error

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) FromBSOND

func (m *MapReduce) FromBSOND(d bson.D) error

From BSOND loads a command from a bson.D

func (*MapReduce) GetCollection

func (m *MapReduce) GetCollection() string

GetCollection returns the collection name for this Command

type OptionalDoc

type OptionalDoc struct {
	bson.D
}

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 Ping

type Ping struct {
	Ping int `bson:"ping"`

	Common `bson:",inline"`
}

the struct for the 'update' command.

func (*Ping) FromBSOND

func (m *Ping) FromBSOND(d bson.D) error

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.

func (*SaslStart) FromBSOND

func (m *SaslStart) FromBSOND(d bson.D) error

type ServerStatus

type ServerStatus struct {
	ServerStatus int `bson:"serverStatus"`

	Common `bson:",inline"`
}

the struct for the 'update' command.

func (*ServerStatus) FromBSOND

func (m *ServerStatus) FromBSOND(d bson.D) error

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

func (s *Session) GetSession() *Session

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) FromBSOND

func (m *ShardCollection) FromBSOND(d bson.D) error

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) FromBSOND

func (m *Update) FromBSOND(d bson.D) error

func (*Update) GetCollection

func (m *Update) GetCollection() string

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) FromBSOND

func (m *Validate) FromBSOND(d bson.D) error

func (*Validate) GetCollection

func (m *Validate) GetCollection() string

type WriteConcern

type WriteConcern struct {
	W        interface{}   `bson:"w"`
	J        bool          `bson:"j"`
	WTimeout time.Duration `bson:"wtimeout"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL