operation

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbortTransaction

type AbortTransaction struct {
	// contains filtered or unexported fields
}

AbortTransaction performs an abortTransaction operation.

func NewAbortTransaction

func NewAbortTransaction() *AbortTransaction

NewAbortTransaction constructs and returns a new AbortTransaction.

func (*AbortTransaction) ClusterClock

func (at *AbortTransaction) ClusterClock(clock *session.ClusterClock) *AbortTransaction

ClusterClock sets the cluster clock for this operation.

func (*AbortTransaction) Collection

func (at *AbortTransaction) Collection(collection string) *AbortTransaction

Collection sets the collection that this command will run against.

func (*AbortTransaction) CommandMonitor

func (at *AbortTransaction) CommandMonitor(monitor *event.CommandMonitor) *AbortTransaction

CommandMonitor sets the monitor to use for APM events.

func (*AbortTransaction) Database

func (at *AbortTransaction) Database(database string) *AbortTransaction

Database sets the database to run this operation against.

func (*AbortTransaction) Deployment

func (at *AbortTransaction) Deployment(deployment driver.Deployment) *AbortTransaction

Deployment sets the deployment to use for this operation.

func (*AbortTransaction) Execute

func (at *AbortTransaction) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*AbortTransaction) RecoveryToken

func (at *AbortTransaction) RecoveryToken(recoveryToken bsoncore.Document) *AbortTransaction

RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.

func (*AbortTransaction) Retry

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*AbortTransaction) ServerSelector

func (at *AbortTransaction) ServerSelector(selector description.ServerSelector) *AbortTransaction

ServerSelector sets the selector used to retrieve a server.

func (*AbortTransaction) Session

func (at *AbortTransaction) Session(session *session.Client) *AbortTransaction

Session sets the session for this operation.

func (*AbortTransaction) WriteConcern

func (at *AbortTransaction) WriteConcern(writeConcern *writeconcern.WriteConcern) *AbortTransaction

WriteConcern sets the write concern for this operation.

type Aggregate

type Aggregate struct {
	// contains filtered or unexported fields
}

Performs an aggregate operation

func NewAggregate

func NewAggregate(pipeline bsoncore.Document) *Aggregate

NewAggregate constructs and returns a new Aggregate.

func (*Aggregate) AllowDiskUse

func (a *Aggregate) AllowDiskUse(allowDiskUse bool) *Aggregate

AllowDiskUse enables writing to temporary files. When true, aggregation stages can write to the dbPath/_tmp directory.

func (*Aggregate) BatchSize

func (a *Aggregate) BatchSize(batchSize int32) *Aggregate

BatchSize specifies the number of documents to return in every batch.

func (*Aggregate) BypassDocumentValidation

func (a *Aggregate) BypassDocumentValidation(bypassDocumentValidation bool) *Aggregate

BypassDocumentValidation allows the write to opt-out of document level validation. This only applies when the $out stage is specified.

func (*Aggregate) ClusterClock

func (a *Aggregate) ClusterClock(clock *session.ClusterClock) *Aggregate

ClusterClock sets the cluster clock for this operation.

func (*Aggregate) Collation

func (a *Aggregate) Collation(collation bsoncore.Document) *Aggregate

Collation specifies a collation. This option is only valid for server versions 3.4 and above.

func (*Aggregate) Collection

func (a *Aggregate) Collection(collection string) *Aggregate

Collection sets the collection that this command will run against.

func (*Aggregate) CommandMonitor

func (a *Aggregate) CommandMonitor(monitor *event.CommandMonitor) *Aggregate

CommandMonitor sets the monitor to use for APM events.

func (*Aggregate) Comment

func (a *Aggregate) Comment(comment string) *Aggregate

Comment specifies an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.

func (*Aggregate) Database

func (a *Aggregate) Database(database string) *Aggregate

Database sets the database to run this operation against.

func (*Aggregate) Deployment

func (a *Aggregate) Deployment(deployment driver.Deployment) *Aggregate

Deployment sets the deployment to use for this operation.

func (*Aggregate) Execute

func (a *Aggregate) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Aggregate) Hint

func (a *Aggregate) Hint(hint bsoncore.Value) *Aggregate

Hint specifies the index to use.

func (*Aggregate) MaxTimeMS

func (a *Aggregate) MaxTimeMS(maxTimeMS int64) *Aggregate

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*Aggregate) Pipeline

func (a *Aggregate) Pipeline(pipeline bsoncore.Document) *Aggregate

Pipeline determines how data is transformed for an aggregation.

func (*Aggregate) ReadConcern

func (a *Aggregate) ReadConcern(readConcern *readconcern.ReadConcern) *Aggregate

ReadConcern specifies the read concern for this operation.

func (*Aggregate) ReadPreference

func (a *Aggregate) ReadPreference(readPreference *readpref.ReadPref) *Aggregate

ReadPreference set the read prefernce used with this operation.

func (*Aggregate) Result

func (a *Aggregate) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)

Result returns the result of executing this operation.

func (*Aggregate) ResultCursorResponse

func (a *Aggregate) ResultCursorResponse() driver.CursorResponse

func (*Aggregate) Retry

func (a *Aggregate) Retry(retry driver.RetryMode) *Aggregate

Retry enables retryable writes for this operation. Retries are not handled automatically, instead a boolean is returned from Execute and SelectAndExecute that indicates if the operation can be retried. Retrying is handled by calling RetryExecute.

func (*Aggregate) ServerSelector

func (a *Aggregate) ServerSelector(selector description.ServerSelector) *Aggregate

ServerSelector sets the selector used to retrieve a server.

func (*Aggregate) Session

func (a *Aggregate) Session(session *session.Client) *Aggregate

Session sets the session for this operation.

func (*Aggregate) WriteConcern

func (a *Aggregate) WriteConcern(writeConcern *writeconcern.WriteConcern) *Aggregate

WriteConcern sets the write concern for this operation.

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command is used to run a generic operation.

func NewCommand

func NewCommand(command bsoncore.Document) *Command

NewCommand constructs and returns a new Command.

func (*Command) ClusterClock

func (c *Command) ClusterClock(clock *session.ClusterClock) *Command

ClusterClock sets the cluster clock for this operation.

func (*Command) Command

func (c *Command) Command(command bsoncore.Document) *Command

Command sets the command to be run.

func (*Command) CommandMonitor

func (c *Command) CommandMonitor(monitor *event.CommandMonitor) *Command

CommandMonitor sets the monitor to use for APM events.

func (*Command) Database

func (c *Command) Database(database string) *Command

Database sets the database to run this operation against.

func (*Command) Deployment

func (c *Command) Deployment(deployment driver.Deployment) *Command

Deployment sets the deployment to use for this operation.

func (*Command) Execute

func (c *Command) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Command) ReadConcern

func (c *Command) ReadConcern(readConcern *readconcern.ReadConcern) *Command

ReadConcern specifies the read concern for this operation.

func (*Command) ReadPreference

func (c *Command) ReadPreference(readPreference *readpref.ReadPref) *Command

ReadPreference set the read prefernce used with this operation.

func (*Command) Result

func (c *Command) Result() bsoncore.Document

Result returns the result of executing this operation.

func (*Command) ResultCursor

func (c *Command) ResultCursor(opts driver.CursorOptions) (*driver.BatchCursor, error)

ResultCursor parses the command response as a cursor and returns the resulting BatchCursor.

func (*Command) ServerSelector

func (c *Command) ServerSelector(selector description.ServerSelector) *Command

ServerSelector sets the selector used to retrieve a server.

func (*Command) Session

func (c *Command) Session(session *session.Client) *Command

Session sets the session for this operation.

type CommitTransaction

type CommitTransaction struct {
	// contains filtered or unexported fields
}

CommitTransaction attempts to commit a transaction.

func NewCommitTransaction

func NewCommitTransaction() *CommitTransaction

NewCommitTransaction constructs and returns a new CommitTransaction.

func (*CommitTransaction) ClusterClock

func (ct *CommitTransaction) ClusterClock(clock *session.ClusterClock) *CommitTransaction

ClusterClock sets the cluster clock for this operation.

func (*CommitTransaction) CommandMonitor

func (ct *CommitTransaction) CommandMonitor(monitor *event.CommandMonitor) *CommitTransaction

CommandMonitor sets the monitor to use for APM events.

func (*CommitTransaction) Database

func (ct *CommitTransaction) Database(database string) *CommitTransaction

Database sets the database to run this operation against.

func (*CommitTransaction) Deployment

func (ct *CommitTransaction) Deployment(deployment driver.Deployment) *CommitTransaction

Deployment sets the deployment to use for this operation.

func (*CommitTransaction) Execute

func (ct *CommitTransaction) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*CommitTransaction) MaxTimeMS

func (ct *CommitTransaction) MaxTimeMS(maxTimeMS int64) *CommitTransaction

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*CommitTransaction) RecoveryToken

func (ct *CommitTransaction) RecoveryToken(recoveryToken bsoncore.Document) *CommitTransaction

RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.

func (*CommitTransaction) Retry

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*CommitTransaction) ServerSelector

func (ct *CommitTransaction) ServerSelector(selector description.ServerSelector) *CommitTransaction

ServerSelector sets the selector used to retrieve a server.

func (*CommitTransaction) Session

func (ct *CommitTransaction) Session(session *session.Client) *CommitTransaction

Session sets the session for this operation.

func (*CommitTransaction) WriteConcern

func (ct *CommitTransaction) WriteConcern(writeConcern *writeconcern.WriteConcern) *CommitTransaction

WriteConcern sets the write concern for this operation.

type Count

type Count struct {
	// contains filtered or unexported fields
}

Performs a count operation

func NewCount

func NewCount() *Count

NewCount constructs and returns a new Count.

func (*Count) ClusterClock

func (c *Count) ClusterClock(clock *session.ClusterClock) *Count

ClusterClock sets the cluster clock for this operation.

func (*Count) Collection

func (c *Count) Collection(collection string) *Count

Collection sets the collection that this command will run against.

func (*Count) CommandMonitor

func (c *Count) CommandMonitor(monitor *event.CommandMonitor) *Count

CommandMonitor sets the monitor to use for APM events.

func (*Count) Database

func (c *Count) Database(database string) *Count

Database sets the database to run this operation against.

func (*Count) Deployment

func (c *Count) Deployment(deployment driver.Deployment) *Count

Deployment sets the deployment to use for this operation.

func (*Count) Execute

func (c *Count) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Count) MaxTimeMS

func (c *Count) MaxTimeMS(maxTimeMS int64) *Count

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*Count) Query

func (c *Count) Query(query bsoncore.Document) *Count

Query determines what results are returned from find.

func (*Count) ReadConcern

func (c *Count) ReadConcern(readConcern *readconcern.ReadConcern) *Count

ReadConcern specifies the read concern for this operation.

func (*Count) ReadPreference

func (c *Count) ReadPreference(readPreference *readpref.ReadPref) *Count

ReadPreference set the read prefernce used with this operation.

func (*Count) Result

func (c *Count) Result() CountResult

Result returns the result of executing this operation.

func (*Count) Retry

func (c *Count) Retry(retry driver.RetryMode) *Count

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*Count) ServerSelector

func (c *Count) ServerSelector(selector description.ServerSelector) *Count

ServerSelector sets the selector used to retrieve a server.

func (*Count) Session

func (c *Count) Session(session *session.Client) *Count

Session sets the session for this operation.

type CountResult

type CountResult struct {
	// The number of documents found
	N int64
}

type CreateIndexes

type CreateIndexes struct {
	// contains filtered or unexported fields
}

CreateIndexes performs a createIndexes operation.

func NewCreateIndexes

func NewCreateIndexes(indexes bsoncore.Document) *CreateIndexes

NewCreateIndexes constructs and returns a new CreateIndexes.

func (*CreateIndexes) ClusterClock

func (ci *CreateIndexes) ClusterClock(clock *session.ClusterClock) *CreateIndexes

ClusterClock sets the cluster clock for this operation.

func (*CreateIndexes) Collection

func (ci *CreateIndexes) Collection(collection string) *CreateIndexes

Collection sets the collection that this command will run against.

func (*CreateIndexes) CommandMonitor

func (ci *CreateIndexes) CommandMonitor(monitor *event.CommandMonitor) *CreateIndexes

CommandMonitor sets the monitor to use for APM events.

func (*CreateIndexes) Database

func (ci *CreateIndexes) Database(database string) *CreateIndexes

Database sets the database to run this operation against.

func (*CreateIndexes) Deployment

func (ci *CreateIndexes) Deployment(deployment driver.Deployment) *CreateIndexes

Deployment sets the deployment to use for this operation.

func (*CreateIndexes) Execute

func (ci *CreateIndexes) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*CreateIndexes) Indexes

func (ci *CreateIndexes) Indexes(indexes bsoncore.Document) *CreateIndexes

An array containing index specification documents for the indexes being created.

func (*CreateIndexes) MaxTimeMS

func (ci *CreateIndexes) MaxTimeMS(maxTimeMS int64) *CreateIndexes

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*CreateIndexes) Result

func (ci *CreateIndexes) Result() CreateIndexesResult

Result returns the result of executing this operation.

func (*CreateIndexes) ServerSelector

func (ci *CreateIndexes) ServerSelector(selector description.ServerSelector) *CreateIndexes

ServerSelector sets the selector used to retrieve a server.

func (*CreateIndexes) Session

func (ci *CreateIndexes) Session(session *session.Client) *CreateIndexes

Session sets the session for this operation.

type CreateIndexesResult

type CreateIndexesResult struct {
	// If the collection was created automatically.
	CreatedCollectionAutomatically bool
	// The number of indexes existing after this command.
	IndexesAfter int32
	// The number of indexes existing before this command.
	IndexesBefore int32
}

type Delete

type Delete struct {
	// contains filtered or unexported fields
}

Delete performs a delete operation

func NewDelete

func NewDelete(deletes ...bsoncore.Document) *Delete

NewDelete constructs and returns a new Delete.

func (*Delete) ClusterClock

func (d *Delete) ClusterClock(clock *session.ClusterClock) *Delete

ClusterClock sets the cluster clock for this operation.

func (*Delete) Collection

func (d *Delete) Collection(collection string) *Delete

Collection sets the collection that this command will run against.

func (*Delete) CommandMonitor

func (d *Delete) CommandMonitor(monitor *event.CommandMonitor) *Delete

CommandMonitor sets the monitor to use for APM events.

func (*Delete) Database

func (d *Delete) Database(database string) *Delete

Database sets the database to run this operation against.

func (*Delete) Deletes

func (d *Delete) Deletes(deletes ...bsoncore.Document) *Delete

Deletes adds documents to this operation that will be used to determine what documents to delete when this operation is executed. These documents should have the form {q: <query>, limit: <integer limit>, collation: <document>}. The collation field is optional. If limit is 0, there will be no limit on the number of documents deleted.

func (*Delete) Deployment

func (d *Delete) Deployment(deployment driver.Deployment) *Delete

Deployment sets the deployment to use for this operation.

func (*Delete) Execute

func (d *Delete) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Delete) Ordered

func (d *Delete) Ordered(ordered bool) *Delete

Ordered sets ordered. If true, when a write fails, the operation will return the error, when false write failures do not stop execution of the operation.

func (*Delete) Result

func (d *Delete) Result() DeleteResult

Result returns the result of executing this operation.

func (*Delete) Retry

func (d *Delete) Retry(retry driver.RetryMode) *Delete

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*Delete) ServerSelector

func (d *Delete) ServerSelector(selector description.ServerSelector) *Delete

ServerSelector sets the selector used to retrieve a server.

func (*Delete) Session

func (d *Delete) Session(session *session.Client) *Delete

Session sets the session for this operation.

func (*Delete) WriteConcern

func (d *Delete) WriteConcern(writeConcern *writeconcern.WriteConcern) *Delete

WriteConcern sets the write concern for this operation.

type DeleteResult

type DeleteResult struct {
	// Number of documents successfully deleted.
	N int32
}

type Distinct

type Distinct struct {
	// contains filtered or unexported fields
}

Distinct performs a distinct operation.

func NewDistinct

func NewDistinct(key string, query bsoncore.Document) *Distinct

NewDistinct constructs and returns a new Distinct.

func (*Distinct) ClusterClock

func (d *Distinct) ClusterClock(clock *session.ClusterClock) *Distinct

ClusterClock sets the cluster clock for this operation.

func (*Distinct) Collation

func (d *Distinct) Collation(collation bsoncore.Document) *Distinct

Collation specifies a collation to be used.

func (*Distinct) Collection

func (d *Distinct) Collection(collection string) *Distinct

Collection sets the collection that this command will run against.

func (*Distinct) CommandMonitor

func (d *Distinct) CommandMonitor(monitor *event.CommandMonitor) *Distinct

CommandMonitor sets the monitor to use for APM events.

func (*Distinct) Database

func (d *Distinct) Database(database string) *Distinct

Database sets the database to run this operation against.

func (*Distinct) Deployment

func (d *Distinct) Deployment(deployment driver.Deployment) *Distinct

Deployment sets the deployment to use for this operation.

func (*Distinct) Execute

func (d *Distinct) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Distinct) Key

func (d *Distinct) Key(key string) *Distinct

Key specifies which field to return distinct values for.

func (*Distinct) MaxTimeMS

func (d *Distinct) MaxTimeMS(maxTimeMS int64) *Distinct

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*Distinct) Query

func (d *Distinct) Query(query bsoncore.Document) *Distinct

Query specifies which documents to return distinct values from.

func (*Distinct) ReadConcern

func (d *Distinct) ReadConcern(readConcern *readconcern.ReadConcern) *Distinct

ReadConcern specifies the read concern for this operation.

func (*Distinct) ReadPreference

func (d *Distinct) ReadPreference(readPreference *readpref.ReadPref) *Distinct

ReadPreference set the read prefernce used with this operation.

func (*Distinct) Result

func (d *Distinct) Result() DistinctResult

Result returns the result of executing this operation.

func (*Distinct) Retry

func (d *Distinct) Retry(retry driver.RetryMode) *Distinct

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*Distinct) ServerSelector

func (d *Distinct) ServerSelector(selector description.ServerSelector) *Distinct

ServerSelector sets the selector used to retrieve a server.

func (*Distinct) Session

func (d *Distinct) Session(session *session.Client) *Distinct

Session sets the session for this operation.

type DistinctResult

type DistinctResult struct {
	// The distinct values for the field.
	Values bsoncore.Value
}

type DropCollection

type DropCollection struct {
	// contains filtered or unexported fields
}

DropCollection performs a drop operation.

func NewDropCollection

func NewDropCollection() *DropCollection

NewDropCollection constructs and returns a new DropCollection.

func (*DropCollection) ClusterClock

func (dc *DropCollection) ClusterClock(clock *session.ClusterClock) *DropCollection

ClusterClock sets the cluster clock for this operation.

func (*DropCollection) Collection

func (dc *DropCollection) Collection(collection string) *DropCollection

Collection sets the collection that this command will run against.

func (*DropCollection) CommandMonitor

func (dc *DropCollection) CommandMonitor(monitor *event.CommandMonitor) *DropCollection

CommandMonitor sets the monitor to use for APM events.

func (*DropCollection) Database

func (dc *DropCollection) Database(database string) *DropCollection

Database sets the database to run this operation against.

func (*DropCollection) Deployment

func (dc *DropCollection) Deployment(deployment driver.Deployment) *DropCollection

Deployment sets the deployment to use for this operation.

func (*DropCollection) Execute

func (dc *DropCollection) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*DropCollection) Result

func (dc *DropCollection) Result() DropCollectionResult

Result returns the result of executing this operation.

func (*DropCollection) ServerSelector

func (dc *DropCollection) ServerSelector(selector description.ServerSelector) *DropCollection

ServerSelector sets the selector used to retrieve a server.

func (*DropCollection) Session

func (dc *DropCollection) Session(session *session.Client) *DropCollection

Session sets the session for this operation.

func (*DropCollection) WriteConcern

func (dc *DropCollection) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropCollection

WriteConcern sets the write concern for this operation.

type DropCollectionResult

type DropCollectionResult struct {
	// The number of indexes in the dropped collection.
	NIndexesWas int32
	// The namespace of the dropped collection.
	Ns string
}

type DropDatabase

type DropDatabase struct {
	// contains filtered or unexported fields
}

DropDatabase performs a dropDatabase operation

func NewDropDatabase

func NewDropDatabase() *DropDatabase

NewDropDatabase constructs and returns a new DropDatabase.

func (*DropDatabase) ClusterClock

func (dd *DropDatabase) ClusterClock(clock *session.ClusterClock) *DropDatabase

ClusterClock sets the cluster clock for this operation.

func (*DropDatabase) CommandMonitor

func (dd *DropDatabase) CommandMonitor(monitor *event.CommandMonitor) *DropDatabase

CommandMonitor sets the monitor to use for APM events.

func (*DropDatabase) Database

func (dd *DropDatabase) Database(database string) *DropDatabase

Database sets the database to run this operation against.

func (*DropDatabase) Deployment

func (dd *DropDatabase) Deployment(deployment driver.Deployment) *DropDatabase

Deployment sets the deployment to use for this operation.

func (*DropDatabase) Execute

func (dd *DropDatabase) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*DropDatabase) Result

func (dd *DropDatabase) Result() DropDatabaseResult

Result returns the result of executing this operation.

func (*DropDatabase) ServerSelector

func (dd *DropDatabase) ServerSelector(selector description.ServerSelector) *DropDatabase

ServerSelector sets the selector used to retrieve a server.

func (*DropDatabase) Session

func (dd *DropDatabase) Session(session *session.Client) *DropDatabase

Session sets the session for this operation.

func (*DropDatabase) WriteConcern

func (dd *DropDatabase) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropDatabase

WriteConcern sets the write concern for this operation.

type DropDatabaseResult

type DropDatabaseResult struct {
	// The dropped database.
	Dropped string
}

type DropIndexes

type DropIndexes struct {
	// contains filtered or unexported fields
}

DropIndexes performs an dropIndexes operation.

func NewDropIndexes

func NewDropIndexes(index string) *DropIndexes

NewDropIndexes constructs and returns a new DropIndexes.

func (*DropIndexes) ClusterClock

func (di *DropIndexes) ClusterClock(clock *session.ClusterClock) *DropIndexes

ClusterClock sets the cluster clock for this operation.

func (*DropIndexes) Collection

func (di *DropIndexes) Collection(collection string) *DropIndexes

Collection sets the collection that this command will run against.

func (*DropIndexes) CommandMonitor

func (di *DropIndexes) CommandMonitor(monitor *event.CommandMonitor) *DropIndexes

CommandMonitor sets the monitor to use for APM events.

func (*DropIndexes) Database

func (di *DropIndexes) Database(database string) *DropIndexes

Database sets the database to run this operation against.

func (*DropIndexes) Deployment

func (di *DropIndexes) Deployment(deployment driver.Deployment) *DropIndexes

Deployment sets the deployment to use for this operation.

func (*DropIndexes) Execute

func (di *DropIndexes) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*DropIndexes) Index

func (di *DropIndexes) Index(index string) *DropIndexes

Index specifies the name of the index to drop. If '*' is specified, all indexes will be dropped.

func (*DropIndexes) MaxTimeMS

func (di *DropIndexes) MaxTimeMS(maxTimeMS int64) *DropIndexes

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*DropIndexes) Result

func (di *DropIndexes) Result() DropIndexesResult

Result returns the result of executing this operation.

func (*DropIndexes) ServerSelector

func (di *DropIndexes) ServerSelector(selector description.ServerSelector) *DropIndexes

ServerSelector sets the selector used to retrieve a server.

func (*DropIndexes) Session

func (di *DropIndexes) Session(session *session.Client) *DropIndexes

Session sets the session for this operation.

func (*DropIndexes) WriteConcern

func (di *DropIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropIndexes

WriteConcern sets the write concern for this operation.

type DropIndexesResult

type DropIndexesResult struct {
	// Number of indexes that existed before the drop was executed.
	NIndexesWas int32
}

type EndSessions

type EndSessions struct {
	// contains filtered or unexported fields
}

EndSessions performs an endSessions operation.

func NewEndSessions

func NewEndSessions(sessionIDs bsoncore.Document) *EndSessions

NewEndSessions constructs and returns a new EndSessions.

func (*EndSessions) ClusterClock

func (es *EndSessions) ClusterClock(clock *session.ClusterClock) *EndSessions

ClusterClock sets the cluster clock for this operation.

func (*EndSessions) CommandMonitor

func (es *EndSessions) CommandMonitor(monitor *event.CommandMonitor) *EndSessions

CommandMonitor sets the monitor to use for APM events.

func (*EndSessions) Database

func (es *EndSessions) Database(database string) *EndSessions

Database sets the database to run this operation against.

func (*EndSessions) Deployment

func (es *EndSessions) Deployment(deployment driver.Deployment) *EndSessions

Deployment sets the deployment to use for this operation.

func (*EndSessions) Execute

func (es *EndSessions) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*EndSessions) ServerSelector

func (es *EndSessions) ServerSelector(selector description.ServerSelector) *EndSessions

ServerSelector sets the selector used to retrieve a server.

func (*EndSessions) Session

func (es *EndSessions) Session(session *session.Client) *EndSessions

Session sets the session for this operation.

func (*EndSessions) SessionIDs

func (es *EndSessions) SessionIDs(sessionIDs bsoncore.Document) *EndSessions

sessionIDs specify the sessions to be expired.

type Find

type Find struct {
	// contains filtered or unexported fields
}

Find performs a find operation.

func NewFind

func NewFind(filter bsoncore.Document) *Find

NewFind constructs and returns a new Find.

func (*Find) AllowPartialResults

func (f *Find) AllowPartialResults(allowPartialResults bool) *Find

AllowPartialResults when true allows partial results to be returned if some shards are down.

func (*Find) AwaitData

func (f *Find) AwaitData(awaitData bool) *Find

AwaitData when true makes a cursor block before returning when no data is available.

func (*Find) BatchSize

func (f *Find) BatchSize(batchSize int32) *Find

BatchSize specifies the number of documents to return in every batch.

func (*Find) ClusterClock

func (f *Find) ClusterClock(clock *session.ClusterClock) *Find

ClusterClock sets the cluster clock for this operation.

func (*Find) Collation

func (f *Find) Collation(collation bsoncore.Document) *Find

Collation specifies a collation to be used.

func (*Find) Collection

func (f *Find) Collection(collection string) *Find

Collection sets the collection that this command will run against.

func (*Find) CommandMonitor

func (f *Find) CommandMonitor(monitor *event.CommandMonitor) *Find

CommandMonitor sets the monitor to use for APM events.

func (*Find) Comment

func (f *Find) Comment(comment string) *Find

Comment sets a string to help trace an operation.

func (*Find) Database

func (f *Find) Database(database string) *Find

Database sets the database to run this operation against.

func (*Find) Deployment

func (f *Find) Deployment(deployment driver.Deployment) *Find

Deployment sets the deployment to use for this operation.

func (*Find) Execute

func (f *Find) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Find) Filter

func (f *Find) Filter(filter bsoncore.Document) *Find

Filter determines what results are returned from find.

func (*Find) Hint

func (f *Find) Hint(hint bsoncore.Value) *Find

Hint specifies the index to use.

func (*Find) Limit

func (f *Find) Limit(limit int64) *Find

Limit sets a limit on the number of documents to return.

func (*Find) Max

func (f *Find) Max(max bsoncore.Document) *Find

Max sets an exclusive upper bound for a specific index.

func (*Find) MaxTimeMS

func (f *Find) MaxTimeMS(maxTimeMS int64) *Find

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*Find) Min

func (f *Find) Min(min bsoncore.Document) *Find

Min sets an inclusive lower bound for a specific index.

func (*Find) NoCursorTimeout

func (f *Find) NoCursorTimeout(noCursorTimeout bool) *Find

NoCursorTimeout when true prevents cursor from timing out after an inactivity period.

func (*Find) OplogReplay

func (f *Find) OplogReplay(oplogReplay bool) *Find

OplogReplay when true replays a replica set's oplog.

func (*Find) Projection

func (f *Find) Projection(projection bsoncore.Document) *Find

Project limits the fields returned for all documents.

func (*Find) ReadConcern

func (f *Find) ReadConcern(readConcern *readconcern.ReadConcern) *Find

ReadConcern specifies the read concern for this operation.

func (*Find) ReadPreference

func (f *Find) ReadPreference(readPreference *readpref.ReadPref) *Find

ReadPreference set the read prefernce used with this operation.

func (*Find) Result

func (f *Find) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)

Result returns the result of executing this operation.

func (*Find) Retry

func (f *Find) Retry(retry driver.RetryMode) *Find

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*Find) ReturnKey

func (f *Find) ReturnKey(returnKey bool) *Find

ReturnKey when true returns index keys for all result documents.

func (*Find) ServerSelector

func (f *Find) ServerSelector(selector description.ServerSelector) *Find

ServerSelector sets the selector used to retrieve a server.

func (*Find) Session

func (f *Find) Session(session *session.Client) *Find

Session sets the session for this operation.

func (*Find) ShowRecordID

func (f *Find) ShowRecordID(showRecordID bool) *Find

ShowRecordID when true adds a $recordId field with the record identifier to returned documents.

func (*Find) SingleBatch

func (f *Find) SingleBatch(singleBatch bool) *Find

SingleBatch specifies whether the results should be returned in a single batch.

func (*Find) Skip

func (f *Find) Skip(skip int64) *Find

Skip specifies the number of documents to skip before returning.

func (*Find) Snapshot

func (f *Find) Snapshot(snapshot bool) *Find

Snapshot prevents the cursor from returning a document more than once because of an intervening write operation.

func (*Find) Sort

func (f *Find) Sort(sort bsoncore.Document) *Find

Sort specifies the order in which to return results.

func (*Find) Tailable

func (f *Find) Tailable(tailable bool) *Find

Tailable keeps a cursor open and resumable after the last data has been retrieved.

type FindAndModify

type FindAndModify struct {
	// contains filtered or unexported fields
}

FindAndModify performs a findAndModify operation.

func NewFindAndModify

func NewFindAndModify(query bsoncore.Document) *FindAndModify

NewFindAndModify constructs and returns a new FindAndModify.

func (*FindAndModify) ArrayFilters

func (fam *FindAndModify) ArrayFilters(arrayFilters bsoncore.Document) *FindAndModify

ArrayFilters specifies an array of filter documents that determines which array elements to modify for an update operation on an array field.

func (*FindAndModify) BypassDocumentValidation

func (fam *FindAndModify) BypassDocumentValidation(bypassDocumentValidation bool) *FindAndModify

BypassDocumentValidation specifies if document validation can be skipped when executing the operation.

func (*FindAndModify) ClusterClock

func (fam *FindAndModify) ClusterClock(clock *session.ClusterClock) *FindAndModify

ClusterClock sets the cluster clock for this operation.

func (*FindAndModify) Collation

func (fam *FindAndModify) Collation(collation bsoncore.Document) *FindAndModify

Collation specifies a collation to be used.

func (*FindAndModify) Collection

func (fam *FindAndModify) Collection(collection string) *FindAndModify

Collection sets the collection that this command will run against.

func (*FindAndModify) CommandMonitor

func (fam *FindAndModify) CommandMonitor(monitor *event.CommandMonitor) *FindAndModify

CommandMonitor sets the monitor to use for APM events.

func (*FindAndModify) Database

func (fam *FindAndModify) Database(database string) *FindAndModify

Database sets the database to run this operation against.

func (*FindAndModify) Deployment

func (fam *FindAndModify) Deployment(deployment driver.Deployment) *FindAndModify

Deployment sets the deployment to use for this operation.

func (*FindAndModify) Execute

func (fam *FindAndModify) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*FindAndModify) Fields

func (fam *FindAndModify) Fields(fields bsoncore.Document) *FindAndModify

Fields specifies a subset of fields to return.

func (*FindAndModify) MaxTimeMS

func (fam *FindAndModify) MaxTimeMS(maxTimeMS int64) *FindAndModify

MaxTimeMS specifies the maximum amount of time to allow the operation to run.

func (*FindAndModify) NewDocument

func (fam *FindAndModify) NewDocument(newDocument bool) *FindAndModify

NewDocument specifies whether to return the modified document or the original. Defaults to false (return original).

func (*FindAndModify) Query

func (fam *FindAndModify) Query(query bsoncore.Document) *FindAndModify

Query specifies the selection criteria for the modification.

func (*FindAndModify) Remove

func (fam *FindAndModify) Remove(remove bool) *FindAndModify

Remove specifies that the matched document should be removed. Defaults to false.

func (*FindAndModify) Result

func (fam *FindAndModify) Result() FindAndModifyResult

Result returns the result of executing this operation.

func (*FindAndModify) Retry

func (fam *FindAndModify) Retry(retry driver.RetryMode) *FindAndModify

Retry enables retryable writes for this operation. Retries are not handled automatically, instead a boolean is returned from Execute and SelectAndExecute that indicates if the operation can be retried. Retrying is handled by calling RetryExecute.

func (*FindAndModify) ServerSelector

func (fam *FindAndModify) ServerSelector(selector description.ServerSelector) *FindAndModify

ServerSelector sets the selector used to retrieve a server.

func (*FindAndModify) Session

func (fam *FindAndModify) Session(session *session.Client) *FindAndModify

Session sets the session for this operation.

func (*FindAndModify) Sort

func (fam *FindAndModify) Sort(sort bsoncore.Document) *FindAndModify

Sort determines which document the operation modifies if the query matches multiple documents.The first document matched by the sort order will be modified.

func (*FindAndModify) Update

func (fam *FindAndModify) Update(update bsoncore.Value) *FindAndModify

Update specifies the update document to perform on the matched document.

func (*FindAndModify) Upsert

func (fam *FindAndModify) Upsert(upsert bool) *FindAndModify

Upsert specifies whether or not to create a new document if no documents match the query when doing an update. Defaults to false.

func (*FindAndModify) WriteConcern

func (fam *FindAndModify) WriteConcern(writeConcern *writeconcern.WriteConcern) *FindAndModify

WriteConcern sets the write concern for this operation.

type FindAndModifyResult

type FindAndModifyResult struct {
	// Either the old or modified document, depending on the value of the new parameter.
	Value bsoncore.Document
	// Contains information about updates and upserts.
	LastErrorObject LastErrorObject
}

type Insert

type Insert struct {
	// contains filtered or unexported fields
}

Insert performs an insert operation.

func NewInsert

func NewInsert(documents ...bsoncore.Document) *Insert

NewInsert constructs and returns a new Insert.

func (*Insert) BypassDocumentValidation

func (i *Insert) BypassDocumentValidation(bypassDocumentValidation bool) *Insert

BypassDocumentValidation allows the operation to opt-out of document level validation. Valid for server versions >= 3.2. For servers < 3.2, this setting is ignored.

func (*Insert) ClusterClock

func (i *Insert) ClusterClock(clock *session.ClusterClock) *Insert

ClusterClock sets the cluster clock for this operation.

func (*Insert) Collection

func (i *Insert) Collection(collection string) *Insert

Collection sets the collection that this command will run against.

func (*Insert) CommandMonitor

func (i *Insert) CommandMonitor(monitor *event.CommandMonitor) *Insert

CommandMonitor sets the monitor to use for APM events.

func (*Insert) Database

func (i *Insert) Database(database string) *Insert

Database sets the database to run this operation against.

func (*Insert) Deployment

func (i *Insert) Deployment(deployment driver.Deployment) *Insert

Deployment sets the deployment to use for this operation.

func (*Insert) Documents

func (i *Insert) Documents(documents ...bsoncore.Document) *Insert

Documents adds documents to this operation that will be inserted when this operation is executed.

func (*Insert) Execute

func (i *Insert) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Insert) Ordered

func (i *Insert) Ordered(ordered bool) *Insert

Ordered sets ordered. If true, when a write fails, the operation will return the error, when false write failures do not stop execution of the operation.

func (*Insert) Result

func (i *Insert) Result() InsertResult

Result returns the result of executing this operation.

func (*Insert) Retry

func (i *Insert) Retry(retry driver.RetryMode) *Insert

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*Insert) ServerSelector

func (i *Insert) ServerSelector(selector description.ServerSelector) *Insert

ServerSelector sets the selector used to retrieve a server.

func (*Insert) Session

func (i *Insert) Session(session *session.Client) *Insert

Session sets the session for this operation.

func (*Insert) WriteConcern

func (i *Insert) WriteConcern(writeConcern *writeconcern.WriteConcern) *Insert

WriteConcern sets the write concern for this operation.

type InsertResult

type InsertResult struct {
	// Number of documents successfully inserted.
	N int32
}

type IsMaster

type IsMaster struct {
	// contains filtered or unexported fields
}

IsMaster is used to run the isMaster handshake operation.

func NewIsMaster

func NewIsMaster() *IsMaster

NewIsMaster constructs an IsMaster.

func (*IsMaster) AppName

func (im *IsMaster) AppName(appname string) *IsMaster

AppName sets the application name in the client metadata sent in this operation.

func (*IsMaster) ClusterClock

func (im *IsMaster) ClusterClock(clock *session.ClusterClock) *IsMaster

ClusterClock sets the cluster clock for this operation.

func (*IsMaster) Compressors

func (im *IsMaster) Compressors(compressors []string) *IsMaster

Compressors sets the compressors that can be used.

func (*IsMaster) Deployment

func (im *IsMaster) Deployment(d driver.Deployment) *IsMaster

Deployment sets the Deployment for this operation.

func (*IsMaster) Execute

func (im *IsMaster) Execute(ctx context.Context) error

Execute runs this operation.

func (*IsMaster) Handshake

Handshake implements the Handshaker interface.

func (*IsMaster) Result

func (im *IsMaster) Result(addr address.Address) description.Server

Result returns the result of executing this operation.

func (*IsMaster) SASLSupportedMechs

func (im *IsMaster) SASLSupportedMechs(username string) *IsMaster

SASLSupportedMechs retrieves the supported SASL mechanism for the given user when this operation is run.

type LastErrorObject

type LastErrorObject struct {
	// True if an update modified an existing document
	UpdatedExisting bool
	// Object ID of the upserted document.
	Upserted interface{}
}

type ListCollections

type ListCollections struct {
	// contains filtered or unexported fields
}

ListCollections performs a listCollections operation.

func NewListCollections

func NewListCollections(filter bsoncore.Document) *ListCollections

NewListCollections constructs and returns a new ListCollections.

func (*ListCollections) ClusterClock

func (lc *ListCollections) ClusterClock(clock *session.ClusterClock) *ListCollections

ClusterClock sets the cluster clock for this operation.

func (*ListCollections) CommandMonitor

func (lc *ListCollections) CommandMonitor(monitor *event.CommandMonitor) *ListCollections

CommandMonitor sets the monitor to use for APM events.

func (*ListCollections) Database

func (lc *ListCollections) Database(database string) *ListCollections

Database sets the database to run this operation against.

func (*ListCollections) Deployment

func (lc *ListCollections) Deployment(deployment driver.Deployment) *ListCollections

Deployment sets the deployment to use for this operation.

func (*ListCollections) Execute

func (lc *ListCollections) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*ListCollections) Filter

func (lc *ListCollections) Filter(filter bsoncore.Document) *ListCollections

Filter determines what results are returned from listCollections.

func (*ListCollections) NameOnly

func (lc *ListCollections) NameOnly(nameOnly bool) *ListCollections

NameOnly specifies whether to only return collection names.

func (*ListCollections) ReadPreference

func (lc *ListCollections) ReadPreference(readPreference *readpref.ReadPref) *ListCollections

ReadPreference set the read prefernce used with this operation.

func (*ListCollections) Result

Result returns the result of executing this operation.

func (*ListCollections) Retry

func (lc *ListCollections) Retry(retry driver.RetryMode) *ListCollections

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*ListCollections) ServerSelector

func (lc *ListCollections) ServerSelector(selector description.ServerSelector) *ListCollections

ServerSelector sets the selector used to retrieve a server.

func (*ListCollections) Session

func (lc *ListCollections) Session(session *session.Client) *ListCollections

Session sets the session for this operation.

type ListDatabases

type ListDatabases struct {
	// contains filtered or unexported fields
}

ListDatabases performs a listDatabases operation.

func NewListDatabases

func NewListDatabases(filter bsoncore.Document) *ListDatabases

NewListDatabases constructs and returns a new ListDatabases.

func (*ListDatabases) ClusterClock

func (ld *ListDatabases) ClusterClock(clock *session.ClusterClock) *ListDatabases

ClusterClock sets the cluster clock for this operation.

func (*ListDatabases) CommandMonitor

func (ld *ListDatabases) CommandMonitor(monitor *event.CommandMonitor) *ListDatabases

CommandMonitor sets the monitor to use for APM events.

func (*ListDatabases) Database

func (ld *ListDatabases) Database(database string) *ListDatabases

Database sets the database to run this operation against.

func (*ListDatabases) Deployment

func (ld *ListDatabases) Deployment(deployment driver.Deployment) *ListDatabases

Deployment sets the deployment to use for this operation.

func (*ListDatabases) Execute

func (ld *ListDatabases) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*ListDatabases) Filter

func (ld *ListDatabases) Filter(filter bsoncore.Document) *ListDatabases

Filter determines what results are returned from listDatabases.

func (*ListDatabases) NameOnly

func (ld *ListDatabases) NameOnly(nameOnly bool) *ListDatabases

NameOnly specifies whether to only return database names.

func (*ListDatabases) ReadPreference

func (ld *ListDatabases) ReadPreference(readPreference *readpref.ReadPref) *ListDatabases

ReadPreference set the read prefernce used with this operation.

func (*ListDatabases) Result

func (ld *ListDatabases) Result() ListDatabasesResult

Result returns the result of executing this operation.

func (*ListDatabases) Retry

func (ld *ListDatabases) Retry(retry driver.RetryMode) *ListDatabases

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*ListDatabases) ServerSelector

func (ld *ListDatabases) ServerSelector(selector description.ServerSelector) *ListDatabases

ServerSelector sets the selector used to retrieve a server.

func (*ListDatabases) Session

func (ld *ListDatabases) Session(session *session.Client) *ListDatabases

Session sets the session for this operation.

type ListDatabasesResult

type ListDatabasesResult struct {
	// An array of documents, one document for each database
	Databases []databaseRecord
	// The sum of the size of all the database files on disk in bytes.
	TotalSize int64
}

type ListIndexes

type ListIndexes struct {
	// contains filtered or unexported fields
}

ListIndexes performs a listIndexes operation.

func NewListIndexes

func NewListIndexes() *ListIndexes

NewListIndexes constructs and returns a new ListIndexes.

func (*ListIndexes) BatchSize

func (li *ListIndexes) BatchSize(batchSize int32) *ListIndexes

BatchSize specifies the number of documents to return in every batch.

func (*ListIndexes) ClusterClock

func (li *ListIndexes) ClusterClock(clock *session.ClusterClock) *ListIndexes

ClusterClock sets the cluster clock for this operation.

func (*ListIndexes) Collection

func (li *ListIndexes) Collection(collection string) *ListIndexes

Collection sets the collection that this command will run against.

func (*ListIndexes) CommandMonitor

func (li *ListIndexes) CommandMonitor(monitor *event.CommandMonitor) *ListIndexes

CommandMonitor sets the monitor to use for APM events.

func (*ListIndexes) Database

func (li *ListIndexes) Database(database string) *ListIndexes

Database sets the database to run this operation against.

func (*ListIndexes) Deployment

func (li *ListIndexes) Deployment(deployment driver.Deployment) *ListIndexes

Deployment sets the deployment to use for this operation.

func (*ListIndexes) Execute

func (li *ListIndexes) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*ListIndexes) MaxTimeMS

func (li *ListIndexes) MaxTimeMS(maxTimeMS int64) *ListIndexes

MaxTimeMS specifies the maximum amount of time to allow the query to run.

func (*ListIndexes) Result

func (li *ListIndexes) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)

Result returns the result of executing this operation.

func (*ListIndexes) Retry

func (li *ListIndexes) Retry(retry driver.RetryMode) *ListIndexes

Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.

func (*ListIndexes) ServerSelector

func (li *ListIndexes) ServerSelector(selector description.ServerSelector) *ListIndexes

ServerSelector sets the selector used to retrieve a server.

func (*ListIndexes) Session

func (li *ListIndexes) Session(session *session.Client) *ListIndexes

Session sets the session for this operation.

type Update

type Update struct {
	// contains filtered or unexported fields
}

Update performs an update operation.

func NewUpdate

func NewUpdate(updates ...bsoncore.Document) *Update

NewUpdate constructs and returns a new Update.

func (*Update) BypassDocumentValidation

func (u *Update) BypassDocumentValidation(bypassDocumentValidation bool) *Update

BypassDocumentValidation allows the operation to opt-out of document level validation. Valid for server versions >= 3.2. For servers < 3.2, this setting is ignored.

func (*Update) ClusterClock

func (u *Update) ClusterClock(clock *session.ClusterClock) *Update

ClusterClock sets the cluster clock for this operation.

func (*Update) Collection

func (u *Update) Collection(collection string) *Update

Collection sets the collection that this command will run against.

func (*Update) CommandMonitor

func (u *Update) CommandMonitor(monitor *event.CommandMonitor) *Update

CommandMonitor sets the monitor to use for APM events.

func (*Update) Database

func (u *Update) Database(database string) *Update

Database sets the database to run this operation against.

func (*Update) Deployment

func (u *Update) Deployment(deployment driver.Deployment) *Update

Deployment sets the deployment to use for this operation.

func (*Update) Execute

func (u *Update) Execute(ctx context.Context) error

Execute runs this operations and returns an error if the operaiton did not execute successfully.

func (*Update) Ordered

func (u *Update) Ordered(ordered bool) *Update

Ordered sets ordered. If true, when a write fails, the operation will return the error, when false write failures do not stop execution of the operation.

func (*Update) Result

func (u *Update) Result() UpdateResult

Result returns the result of executing this operation.

func (*Update) Retry

func (u *Update) Retry(retry driver.RetryMode) *Update

Retry enables retryable writes for this operation. Retries are not handled automatically, instead a boolean is returned from Execute and SelectAndExecute that indicates if the operation can be retried. Retrying is handled by calling RetryExecute.

func (*Update) ServerSelector

func (u *Update) ServerSelector(selector description.ServerSelector) *Update

ServerSelector sets the selector used to retrieve a server.

func (*Update) Session

func (u *Update) Session(session *session.Client) *Update

Session sets the session for this operation.

func (*Update) Updates

func (u *Update) Updates(updates ...bsoncore.Document) *Update

Updates specifies an array of update statements to perform when this operation is executed. Each update document must have the following structure: {q: <query>, u: <update>, multi: <boolean>, collation: Optional<Document>, arrayFitlers: Optional<Array>}.

func (*Update) WriteConcern

func (u *Update) WriteConcern(writeConcern *writeconcern.WriteConcern) *Update

WriteConcern sets the write concern for this operation.

type UpdateResult

type UpdateResult struct {
	// Number of documents matched.
	N int32
	// Number of documents modified.
	NModified int32
	// Information about upserted documents.
	Upserted []Upsert
}

UpdateResult contains information for the result of an Update operation.

type Upsert

type Upsert struct {
	Index int64
	ID    interface{} `bson:"_id"`
}

Upsert contains the information for an upsert in an Update operation.

Jump to

Keyboard shortcuts

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