AbortTransaction performs an abortTransaction operation.
type AbortTransaction struct {
// contains filtered or unexported fields
}
func NewAbortTransaction() *AbortTransaction
NewAbortTransaction constructs and returns a new AbortTransaction.
func (at *AbortTransaction) ClusterClock(clock *session.ClusterClock) *AbortTransaction
ClusterClock sets the cluster clock for this operation.
func (at *AbortTransaction) Collection(collection string) *AbortTransaction
Collection sets the collection that this command will run against.
func (at *AbortTransaction) CommandMonitor(monitor *event.CommandMonitor) *AbortTransaction
CommandMonitor sets the monitor to use for APM events.
func (at *AbortTransaction) Crypt(crypt driver.Crypt) *AbortTransaction
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (at *AbortTransaction) Database(database string) *AbortTransaction
Database sets the database to run this operation against.
func (at *AbortTransaction) Deployment(deployment driver.Deployment) *AbortTransaction
Deployment sets the deployment to use for this operation.
func (at *AbortTransaction) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (at *AbortTransaction) RecoveryToken(recoveryToken bsoncore.Document) *AbortTransaction
RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.
func (at *AbortTransaction) Retry(retry driver.RetryMode) *AbortTransaction
Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.
func (at *AbortTransaction) ServerAPI(serverAPI *driver.ServerAPIOptions) *AbortTransaction
ServerAPI sets the server API version for this operation.
func (at *AbortTransaction) ServerSelector(selector description.ServerSelector) *AbortTransaction
ServerSelector sets the selector used to retrieve a server.
func (at *AbortTransaction) Session(session *session.Client) *AbortTransaction
Session sets the session for this operation.
func (at *AbortTransaction) WriteConcern(writeConcern *writeconcern.WriteConcern) *AbortTransaction
WriteConcern sets the write concern for this operation.
Aggregate represents an aggregate operation.
type Aggregate struct {
// contains filtered or unexported fields
}
func NewAggregate(pipeline bsoncore.Document) *Aggregate
NewAggregate constructs and returns a new Aggregate.
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 (a *Aggregate) BatchSize(batchSize int32) *Aggregate
BatchSize specifies the number of documents to return in every batch.
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 (a *Aggregate) ClusterClock(clock *session.ClusterClock) *Aggregate
ClusterClock sets the cluster clock for this operation.
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 (a *Aggregate) Collection(collection string) *Aggregate
Collection sets the collection that this command will run against.
func (a *Aggregate) CommandMonitor(monitor *event.CommandMonitor) *Aggregate
CommandMonitor sets the monitor to use for APM events.
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 (a *Aggregate) Crypt(crypt driver.Crypt) *Aggregate
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (a *Aggregate) CustomOptions(co map[string]bsoncore.Value) *Aggregate
CustomOptions specifies extra options to use in the aggregate command.
func (a *Aggregate) Database(database string) *Aggregate
Database sets the database to run this operation against.
func (a *Aggregate) Deployment(deployment driver.Deployment) *Aggregate
Deployment sets the deployment to use for this operation.
func (a *Aggregate) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (a *Aggregate) HasOutputStage(hos bool) *Aggregate
HasOutputStage specifies whether the aggregate contains an output stage. Used in determining when to append read preference at the operation level.
func (a *Aggregate) Hint(hint bsoncore.Value) *Aggregate
Hint specifies the index to use.
func (a *Aggregate) Let(let bsoncore.Document) *Aggregate
Let specifies the let document to use. This option is only valid for server versions 5.0 and above.
func (a *Aggregate) MaxTime(maxTime *time.Duration) *Aggregate
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (a *Aggregate) OmitCSOTMaxTimeMS(omit bool) *Aggregate
OmitCSOTMaxTimeMS omits the automatically-calculated "maxTimeMS" from the command when CSOT is enabled. It does not effect "maxTimeMS" set by Aggregate.MaxTime.
func (a *Aggregate) Pipeline(pipeline bsoncore.Document) *Aggregate
Pipeline determines how data is transformed for an aggregation.
func (a *Aggregate) ReadConcern(readConcern *readconcern.ReadConcern) *Aggregate
ReadConcern specifies the read concern for this operation.
func (a *Aggregate) ReadPreference(readPreference *readpref.ReadPref) *Aggregate
ReadPreference set the read preference used with this operation.
func (a *Aggregate) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)
Result returns the result of executing this operation.
func (a *Aggregate) ResultCursorResponse() driver.CursorResponse
ResultCursorResponse returns the underlying CursorResponse result of executing this operation.
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 (a *Aggregate) ServerAPI(serverAPI *driver.ServerAPIOptions) *Aggregate
ServerAPI sets the server API version for this operation.
func (a *Aggregate) ServerSelector(selector description.ServerSelector) *Aggregate
ServerSelector sets the selector used to retrieve a server.
func (a *Aggregate) Session(session *session.Client) *Aggregate
Session sets the session for this operation.
func (a *Aggregate) Timeout(timeout *time.Duration) *Aggregate
Timeout sets the timeout for this operation.
func (a *Aggregate) WriteConcern(writeConcern *writeconcern.WriteConcern) *Aggregate
WriteConcern sets the write concern for this operation.
Command is used to run a generic operation.
type Command struct {
// contains filtered or unexported fields
}
func NewCommand(command bsoncore.Document) *Command
NewCommand constructs and returns a new Command. Once the operation is executed, the result may only be accessed via the Result() function.
func NewCursorCommand(command bsoncore.Document, cursorOpts driver.CursorOptions) *Command
NewCursorCommand constructs a new Command. Once the operation is executed, the server response will be used to construct a cursor, which can be accessed via the ResultCursor() function.
func (c *Command) ClusterClock(clock *session.ClusterClock) *Command
ClusterClock sets the cluster clock for this operation.
func (c *Command) CommandMonitor(monitor *event.CommandMonitor) *Command
CommandMonitor sets the monitor to use for APM events.
func (c *Command) Crypt(crypt driver.Crypt) *Command
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (c *Command) Database(database string) *Command
Database sets the database to run this operation against.
func (c *Command) Deployment(deployment driver.Deployment) *Command
Deployment sets the deployment to use for this operation.
func (c *Command) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (c *Command) Logger(logger *logger.Logger) *Command
Logger sets the logger for this operation.
func (c *Command) ReadPreference(readPreference *readpref.ReadPref) *Command
ReadPreference set the read preference used with this operation.
func (c *Command) Result() bsoncore.Document
Result returns the result of executing this operation.
func (c *Command) ResultCursor() (*driver.BatchCursor, error)
ResultCursor returns the BatchCursor that was constructed using the command response. If the operation was not configured to create a cursor (i.e. it was created using NewCommand rather than NewCursorCommand), this function will return nil and an error.
func (c *Command) ServerAPI(serverAPI *driver.ServerAPIOptions) *Command
ServerAPI sets the server API version for this operation.
func (c *Command) ServerSelector(selector description.ServerSelector) *Command
ServerSelector sets the selector used to retrieve a server.
func (c *Command) Session(session *session.Client) *Command
Session sets the session for this operation.
func (c *Command) Timeout(timeout *time.Duration) *Command
Timeout sets the timeout for this operation.
CommitTransaction attempts to commit a transaction.
type CommitTransaction struct {
// contains filtered or unexported fields
}
func NewCommitTransaction() *CommitTransaction
NewCommitTransaction constructs and returns a new CommitTransaction.
func (ct *CommitTransaction) ClusterClock(clock *session.ClusterClock) *CommitTransaction
ClusterClock sets the cluster clock for this operation.
func (ct *CommitTransaction) CommandMonitor(monitor *event.CommandMonitor) *CommitTransaction
CommandMonitor sets the monitor to use for APM events.
func (ct *CommitTransaction) Crypt(crypt driver.Crypt) *CommitTransaction
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (ct *CommitTransaction) Database(database string) *CommitTransaction
Database sets the database to run this operation against.
func (ct *CommitTransaction) Deployment(deployment driver.Deployment) *CommitTransaction
Deployment sets the deployment to use for this operation.
func (ct *CommitTransaction) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (ct *CommitTransaction) MaxTime(maxTime *time.Duration) *CommitTransaction
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (ct *CommitTransaction) RecoveryToken(recoveryToken bsoncore.Document) *CommitTransaction
RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.
func (ct *CommitTransaction) Retry(retry driver.RetryMode) *CommitTransaction
Retry enables retryable mode for this operation. Retries are handled automatically in driver.Operation.Execute based on how the operation is set.
func (ct *CommitTransaction) ServerAPI(serverAPI *driver.ServerAPIOptions) *CommitTransaction
ServerAPI sets the server API version for this operation.
func (ct *CommitTransaction) ServerSelector(selector description.ServerSelector) *CommitTransaction
ServerSelector sets the selector used to retrieve a server.
func (ct *CommitTransaction) Session(session *session.Client) *CommitTransaction
Session sets the session for this operation.
func (ct *CommitTransaction) WriteConcern(writeConcern *writeconcern.WriteConcern) *CommitTransaction
WriteConcern sets the write concern for this operation.
Count represents a count operation.
type Count struct {
// contains filtered or unexported fields
}
func NewCount() *Count
NewCount constructs and returns a new Count.
func (c *Count) ClusterClock(clock *session.ClusterClock) *Count
ClusterClock sets the cluster clock for this operation.
func (c *Count) Collection(collection string) *Count
Collection sets the collection that this command will run against.
func (c *Count) CommandMonitor(monitor *event.CommandMonitor) *Count
CommandMonitor sets the monitor to use for APM events.
func (c *Count) Comment(comment bsoncore.Value) *Count
Comment sets a value to help trace an operation.
func (c *Count) Crypt(crypt driver.Crypt) *Count
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (c *Count) Database(database string) *Count
Database sets the database to run this operation against.
func (c *Count) Deployment(deployment driver.Deployment) *Count
Deployment sets the deployment to use for this operation.
func (c *Count) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (c *Count) MaxTime(maxTime *time.Duration) *Count
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (c *Count) Query(query bsoncore.Document) *Count
Query determines what results are returned from find.
func (c *Count) ReadConcern(readConcern *readconcern.ReadConcern) *Count
ReadConcern specifies the read concern for this operation.
func (c *Count) ReadPreference(readPreference *readpref.ReadPref) *Count
ReadPreference set the read preference used with this operation.
func (c *Count) Result() CountResult
Result returns the result of executing this operation.
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 (c *Count) ServerAPI(serverAPI *driver.ServerAPIOptions) *Count
ServerAPI sets the server API version for this operation.
func (c *Count) ServerSelector(selector description.ServerSelector) *Count
ServerSelector sets the selector used to retrieve a server.
func (c *Count) Session(session *session.Client) *Count
Session sets the session for this operation.
func (c *Count) Timeout(timeout *time.Duration) *Count
Timeout sets the timeout for this operation.
CountResult represents a count result returned by the server.
type CountResult struct { // The number of documents found N int64 }
Create represents a create operation.
type Create struct {
// contains filtered or unexported fields
}
func NewCreate(collectionName string) *Create
NewCreate constructs and returns a new Create.
func (c *Create) Capped(capped bool) *Create
Capped specifies if the collection is capped.
func (c *Create) ChangeStreamPreAndPostImages(csppi bsoncore.Document) *Create
ChangeStreamPreAndPostImages specifies how change streams opened against the collection can return pre- and post-images of updated documents. This option is only valid for server versions 6.0 and above.
func (c *Create) ClusterClock(clock *session.ClusterClock) *Create
ClusterClock sets the cluster clock for this operation.
func (c *Create) ClusteredIndex(ci bsoncore.Document) *Create
ClusteredIndex sets the ClusteredIndex option for this operation.
func (c *Create) Collation(collation bsoncore.Document) *Create
Collation specifies a collation. This option is only valid for server versions 3.4 and above.
func (c *Create) CollectionName(collectionName string) *Create
CollectionName specifies the name of the collection to create.
func (c *Create) CommandMonitor(monitor *event.CommandMonitor) *Create
CommandMonitor sets the monitor to use for APM events.
func (c *Create) Crypt(crypt driver.Crypt) *Create
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (c *Create) Database(database string) *Create
Database sets the database to run this operation against.
func (c *Create) Deployment(deployment driver.Deployment) *Create
Deployment sets the deployment to use for this operation.
func (c *Create) EncryptedFields(ef bsoncore.Document) *Create
EncryptedFields sets the EncryptedFields for this operation.
func (c *Create) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (c *Create) ExpireAfterSeconds(eas int64) *Create
ExpireAfterSeconds sets the seconds to wait before deleting old time-series data.
func (c *Create) IndexOptionDefaults(indexOptionDefaults bsoncore.Document) *Create
IndexOptionDefaults specifies a default configuration for indexes on the collection.
func (c *Create) Max(max int64) *Create
Max specifies the maximum number of documents allowed in a capped collection.
func (c *Create) Pipeline(pipeline bsoncore.Document) *Create
Pipeline specifies the agggregtion pipeline to be run against the source to create the view.
func (c *Create) ServerAPI(serverAPI *driver.ServerAPIOptions) *Create
ServerAPI sets the server API version for this operation.
func (c *Create) ServerSelector(selector description.ServerSelector) *Create
ServerSelector sets the selector used to retrieve a server.
func (c *Create) Session(session *session.Client) *Create
Session sets the session for this operation.
func (c *Create) Size(size int64) *Create
Size specifies the maximum size in bytes for a capped collection.
func (c *Create) StorageEngine(storageEngine bsoncore.Document) *Create
StorageEngine specifies the storage engine to use for the index.
func (c *Create) TimeSeries(timeSeries bsoncore.Document) *Create
TimeSeries sets the time series options for this operation.
func (c *Create) ValidationAction(validationAction string) *Create
ValidationAction specifies what should happen if a document being inserted does not pass validation.
func (c *Create) ValidationLevel(validationLevel string) *Create
ValidationLevel specifies how strictly the server applies validation rules to existing documents in the collection during update operations.
func (c *Create) Validator(validator bsoncore.Document) *Create
Validator specifies validation rules for the collection.
func (c *Create) ViewOn(viewOn string) *Create
ViewOn specifies the name of the source collection or view on which the view will be created.
func (c *Create) WriteConcern(writeConcern *writeconcern.WriteConcern) *Create
WriteConcern sets the write concern for this operation.
CreateIndexes performs a createIndexes operation.
type CreateIndexes struct {
// contains filtered or unexported fields
}
func NewCreateIndexes(indexes bsoncore.Document) *CreateIndexes
NewCreateIndexes constructs and returns a new CreateIndexes.
func (ci *CreateIndexes) ClusterClock(clock *session.ClusterClock) *CreateIndexes
ClusterClock sets the cluster clock for this operation.
func (ci *CreateIndexes) Collection(collection string) *CreateIndexes
Collection sets the collection that this command will run against.
func (ci *CreateIndexes) CommandMonitor(monitor *event.CommandMonitor) *CreateIndexes
CommandMonitor sets the monitor to use for APM events.
func (ci *CreateIndexes) CommitQuorum(commitQuorum bsoncore.Value) *CreateIndexes
CommitQuorum specifies the number of data-bearing members of a replica set, including the primary, that must complete the index builds successfully before the primary marks the indexes as ready. This should either be a string or int32 value.
func (ci *CreateIndexes) Crypt(crypt driver.Crypt) *CreateIndexes
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (ci *CreateIndexes) Database(database string) *CreateIndexes
Database sets the database to run this operation against.
func (ci *CreateIndexes) Deployment(deployment driver.Deployment) *CreateIndexes
Deployment sets the deployment to use for this operation.
func (ci *CreateIndexes) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (ci *CreateIndexes) Indexes(indexes bsoncore.Document) *CreateIndexes
Indexes specifies an array containing index specification documents for the indexes being created.
func (ci *CreateIndexes) MaxTime(maxTime *time.Duration) *CreateIndexes
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (ci *CreateIndexes) Result() CreateIndexesResult
Result returns the result of executing this operation.
func (ci *CreateIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *CreateIndexes
ServerAPI sets the server API version for this operation.
func (ci *CreateIndexes) ServerSelector(selector description.ServerSelector) *CreateIndexes
ServerSelector sets the selector used to retrieve a server.
func (ci *CreateIndexes) Session(session *session.Client) *CreateIndexes
Session sets the session for this operation.
func (ci *CreateIndexes) Timeout(timeout *time.Duration) *CreateIndexes
Timeout sets the timeout for this operation.
func (ci *CreateIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) *CreateIndexes
WriteConcern sets the write concern for this operation.
CreateIndexesResult represents a createIndexes result returned by the server.
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 }
CreateSearchIndexResult represents a single search index result in CreateSearchIndexesResult.
type CreateSearchIndexResult struct { Name string }
CreateSearchIndexes performs a createSearchIndexes operation.
type CreateSearchIndexes struct {
// contains filtered or unexported fields
}
func NewCreateSearchIndexes(indexes bsoncore.Document) *CreateSearchIndexes
NewCreateSearchIndexes constructs and returns a new CreateSearchIndexes.
func (csi *CreateSearchIndexes) ClusterClock(clock *session.ClusterClock) *CreateSearchIndexes
ClusterClock sets the cluster clock for this operation.
func (csi *CreateSearchIndexes) Collection(collection string) *CreateSearchIndexes
Collection sets the collection that this command will run against.
func (csi *CreateSearchIndexes) CommandMonitor(monitor *event.CommandMonitor) *CreateSearchIndexes
CommandMonitor sets the monitor to use for APM events.
func (csi *CreateSearchIndexes) Crypt(crypt driver.Crypt) *CreateSearchIndexes
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (csi *CreateSearchIndexes) Database(database string) *CreateSearchIndexes
Database sets the database to run this operation against.
func (csi *CreateSearchIndexes) Deployment(deployment driver.Deployment) *CreateSearchIndexes
Deployment sets the deployment to use for this operation.
func (csi *CreateSearchIndexes) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (csi *CreateSearchIndexes) Indexes(indexes bsoncore.Document) *CreateSearchIndexes
Indexes specifies an array containing index specification documents for the indexes being created.
func (csi *CreateSearchIndexes) Result() CreateSearchIndexesResult
Result returns the result of executing this operation.
func (csi *CreateSearchIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *CreateSearchIndexes
ServerAPI sets the server API version for this operation.
func (csi *CreateSearchIndexes) ServerSelector(selector description.ServerSelector) *CreateSearchIndexes
ServerSelector sets the selector used to retrieve a server.
func (csi *CreateSearchIndexes) Session(session *session.Client) *CreateSearchIndexes
Session sets the session for this operation.
func (csi *CreateSearchIndexes) Timeout(timeout *time.Duration) *CreateSearchIndexes
Timeout sets the timeout for this operation.
func (csi *CreateSearchIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) *CreateSearchIndexes
WriteConcern sets the write concern for this operation.
CreateSearchIndexesResult represents a createSearchIndexes result returned by the server.
type CreateSearchIndexesResult struct { IndexesCreated []CreateSearchIndexResult }
Delete performs a delete operation
type Delete struct {
// contains filtered or unexported fields
}
func NewDelete(deletes ...bsoncore.Document) *Delete
NewDelete constructs and returns a new Delete.
func (d *Delete) ClusterClock(clock *session.ClusterClock) *Delete
ClusterClock sets the cluster clock for this operation.
func (d *Delete) Collection(collection string) *Delete
Collection sets the collection that this command will run against.
func (d *Delete) CommandMonitor(monitor *event.CommandMonitor) *Delete
CommandMonitor sets the monitor to use for APM events.
func (d *Delete) Comment(comment bsoncore.Value) *Delete
Comment sets a value to help trace an operation.
func (d *Delete) Crypt(crypt driver.Crypt) *Delete
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (d *Delete) Database(database string) *Delete
Database sets the database to run this operation against.
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 (d *Delete) Deployment(deployment driver.Deployment) *Delete
Deployment sets the deployment to use for this operation.
func (d *Delete) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (d *Delete) Hint(hint bool) *Delete
Hint is a flag to indicate that the update document contains a hint. Hint is only supported by servers >= 4.4. Older servers >= 3.4 will report an error for using the hint option. For servers < 3.4, the driver will return an error if the hint option is used.
func (d *Delete) Let(let bsoncore.Document) *Delete
Let specifies the let document to use. This option is only valid for server versions 5.0 and above.
func (d *Delete) Logger(logger *logger.Logger) *Delete
Logger sets the logger for this operation.
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 (d *Delete) Result() DeleteResult
Result returns the result of executing this operation.
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 (d *Delete) ServerAPI(serverAPI *driver.ServerAPIOptions) *Delete
ServerAPI sets the server API version for this operation.
func (d *Delete) ServerSelector(selector description.ServerSelector) *Delete
ServerSelector sets the selector used to retrieve a server.
func (d *Delete) Session(session *session.Client) *Delete
Session sets the session for this operation.
func (d *Delete) Timeout(timeout *time.Duration) *Delete
Timeout sets the timeout for this operation.
func (d *Delete) WriteConcern(writeConcern *writeconcern.WriteConcern) *Delete
WriteConcern sets the write concern for this operation.
DeleteResult represents a delete result returned by the server.
type DeleteResult struct { // Number of documents successfully deleted. N int64 }
Distinct performs a distinct operation.
type Distinct struct {
// contains filtered or unexported fields
}
func NewDistinct(key string, query bsoncore.Document) *Distinct
NewDistinct constructs and returns a new Distinct.
func (d *Distinct) ClusterClock(clock *session.ClusterClock) *Distinct
ClusterClock sets the cluster clock for this operation.
func (d *Distinct) Collation(collation bsoncore.Document) *Distinct
Collation specifies a collation to be used.
func (d *Distinct) Collection(collection string) *Distinct
Collection sets the collection that this command will run against.
func (d *Distinct) CommandMonitor(monitor *event.CommandMonitor) *Distinct
CommandMonitor sets the monitor to use for APM events.
func (d *Distinct) Comment(comment bsoncore.Value) *Distinct
Comment sets a value to help trace an operation.
func (d *Distinct) Crypt(crypt driver.Crypt) *Distinct
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (d *Distinct) Database(database string) *Distinct
Database sets the database to run this operation against.
func (d *Distinct) Deployment(deployment driver.Deployment) *Distinct
Deployment sets the deployment to use for this operation.
func (d *Distinct) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (d *Distinct) Key(key string) *Distinct
Key specifies which field to return distinct values for.
func (d *Distinct) MaxTime(maxTime *time.Duration) *Distinct
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (d *Distinct) Query(query bsoncore.Document) *Distinct
Query specifies which documents to return distinct values from.
func (d *Distinct) ReadConcern(readConcern *readconcern.ReadConcern) *Distinct
ReadConcern specifies the read concern for this operation.
func (d *Distinct) ReadPreference(readPreference *readpref.ReadPref) *Distinct
ReadPreference set the read preference used with this operation.
func (d *Distinct) Result() DistinctResult
Result returns the result of executing this operation.
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 (d *Distinct) ServerAPI(serverAPI *driver.ServerAPIOptions) *Distinct
ServerAPI sets the server API version for this operation.
func (d *Distinct) ServerSelector(selector description.ServerSelector) *Distinct
ServerSelector sets the selector used to retrieve a server.
func (d *Distinct) Session(session *session.Client) *Distinct
Session sets the session for this operation.
func (d *Distinct) Timeout(timeout *time.Duration) *Distinct
Timeout sets the timeout for this operation.
DistinctResult represents a distinct result returned by the server.
type DistinctResult struct { // The distinct values for the field. Values bsoncore.Value }
DropCollection performs a drop operation.
type DropCollection struct {
// contains filtered or unexported fields
}
func NewDropCollection() *DropCollection
NewDropCollection constructs and returns a new DropCollection.
func (dc *DropCollection) ClusterClock(clock *session.ClusterClock) *DropCollection
ClusterClock sets the cluster clock for this operation.
func (dc *DropCollection) Collection(collection string) *DropCollection
Collection sets the collection that this command will run against.
func (dc *DropCollection) CommandMonitor(monitor *event.CommandMonitor) *DropCollection
CommandMonitor sets the monitor to use for APM events.
func (dc *DropCollection) Crypt(crypt driver.Crypt) *DropCollection
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (dc *DropCollection) Database(database string) *DropCollection
Database sets the database to run this operation against.
func (dc *DropCollection) Deployment(deployment driver.Deployment) *DropCollection
Deployment sets the deployment to use for this operation.
func (dc *DropCollection) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (dc *DropCollection) Result() DropCollectionResult
Result returns the result of executing this operation.
func (dc *DropCollection) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropCollection
ServerAPI sets the server API version for this operation.
func (dc *DropCollection) ServerSelector(selector description.ServerSelector) *DropCollection
ServerSelector sets the selector used to retrieve a server.
func (dc *DropCollection) Session(session *session.Client) *DropCollection
Session sets the session for this operation.
func (dc *DropCollection) Timeout(timeout *time.Duration) *DropCollection
Timeout sets the timeout for this operation.
func (dc *DropCollection) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropCollection
WriteConcern sets the write concern for this operation.
DropCollectionResult represents a dropCollection result returned by the server.
type DropCollectionResult struct { // The number of indexes in the dropped collection. NIndexesWas int32 // The namespace of the dropped collection. Ns string }
DropDatabase performs a dropDatabase operation
type DropDatabase struct {
// contains filtered or unexported fields
}
func NewDropDatabase() *DropDatabase
NewDropDatabase constructs and returns a new DropDatabase.
func (dd *DropDatabase) ClusterClock(clock *session.ClusterClock) *DropDatabase
ClusterClock sets the cluster clock for this operation.
func (dd *DropDatabase) CommandMonitor(monitor *event.CommandMonitor) *DropDatabase
CommandMonitor sets the monitor to use for APM events.
func (dd *DropDatabase) Crypt(crypt driver.Crypt) *DropDatabase
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (dd *DropDatabase) Database(database string) *DropDatabase
Database sets the database to run this operation against.
func (dd *DropDatabase) Deployment(deployment driver.Deployment) *DropDatabase
Deployment sets the deployment to use for this operation.
func (dd *DropDatabase) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (dd *DropDatabase) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropDatabase
ServerAPI sets the server API version for this operation.
func (dd *DropDatabase) ServerSelector(selector description.ServerSelector) *DropDatabase
ServerSelector sets the selector used to retrieve a server.
func (dd *DropDatabase) Session(session *session.Client) *DropDatabase
Session sets the session for this operation.
func (dd *DropDatabase) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropDatabase
WriteConcern sets the write concern for this operation.
DropIndexes performs an dropIndexes operation.
type DropIndexes struct {
// contains filtered or unexported fields
}
func NewDropIndexes(index string) *DropIndexes
NewDropIndexes constructs and returns a new DropIndexes.
func (di *DropIndexes) ClusterClock(clock *session.ClusterClock) *DropIndexes
ClusterClock sets the cluster clock for this operation.
func (di *DropIndexes) Collection(collection string) *DropIndexes
Collection sets the collection that this command will run against.
func (di *DropIndexes) CommandMonitor(monitor *event.CommandMonitor) *DropIndexes
CommandMonitor sets the monitor to use for APM events.
func (di *DropIndexes) Crypt(crypt driver.Crypt) *DropIndexes
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (di *DropIndexes) Database(database string) *DropIndexes
Database sets the database to run this operation against.
func (di *DropIndexes) Deployment(deployment driver.Deployment) *DropIndexes
Deployment sets the deployment to use for this operation.
func (di *DropIndexes) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
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 (di *DropIndexes) MaxTime(maxTime *time.Duration) *DropIndexes
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (di *DropIndexes) Result() DropIndexesResult
Result returns the result of executing this operation.
func (di *DropIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropIndexes
ServerAPI sets the server API version for this operation.
func (di *DropIndexes) ServerSelector(selector description.ServerSelector) *DropIndexes
ServerSelector sets the selector used to retrieve a server.
func (di *DropIndexes) Session(session *session.Client) *DropIndexes
Session sets the session for this operation.
func (di *DropIndexes) Timeout(timeout *time.Duration) *DropIndexes
Timeout sets the timeout for this operation.
func (di *DropIndexes) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropIndexes
WriteConcern sets the write concern for this operation.
DropIndexesResult represents a dropIndexes result returned by the server.
type DropIndexesResult struct { // Number of indexes that existed before the drop was executed. NIndexesWas int32 }
DropSearchIndex performs an dropSearchIndex operation.
type DropSearchIndex struct {
// contains filtered or unexported fields
}
func NewDropSearchIndex(index string) *DropSearchIndex
NewDropSearchIndex constructs and returns a new DropSearchIndex.
func (dsi *DropSearchIndex) ClusterClock(clock *session.ClusterClock) *DropSearchIndex
ClusterClock sets the cluster clock for this operation.
func (dsi *DropSearchIndex) Collection(collection string) *DropSearchIndex
Collection sets the collection that this command will run against.
func (dsi *DropSearchIndex) CommandMonitor(monitor *event.CommandMonitor) *DropSearchIndex
CommandMonitor sets the monitor to use for APM events.
func (dsi *DropSearchIndex) Crypt(crypt driver.Crypt) *DropSearchIndex
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (dsi *DropSearchIndex) Database(database string) *DropSearchIndex
Database sets the database to run this operation against.
func (dsi *DropSearchIndex) Deployment(deployment driver.Deployment) *DropSearchIndex
Deployment sets the deployment to use for this operation.
func (dsi *DropSearchIndex) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (dsi *DropSearchIndex) Index(index string) *DropSearchIndex
Index specifies the name of the index to drop. If '*' is specified, all indexes will be dropped.
func (dsi *DropSearchIndex) Result() DropSearchIndexResult
Result returns the result of executing this operation.
func (dsi *DropSearchIndex) ServerAPI(serverAPI *driver.ServerAPIOptions) *DropSearchIndex
ServerAPI sets the server API version for this operation.
func (dsi *DropSearchIndex) ServerSelector(selector description.ServerSelector) *DropSearchIndex
ServerSelector sets the selector used to retrieve a server.
func (dsi *DropSearchIndex) Session(session *session.Client) *DropSearchIndex
Session sets the session for this operation.
func (dsi *DropSearchIndex) Timeout(timeout *time.Duration) *DropSearchIndex
Timeout sets the timeout for this operation.
func (dsi *DropSearchIndex) WriteConcern(writeConcern *writeconcern.WriteConcern) *DropSearchIndex
WriteConcern sets the write concern for this operation.
DropSearchIndexResult represents a dropSearchIndex result returned by the server.
type DropSearchIndexResult struct { Ok int32 }
EndSessions performs an endSessions operation.
type EndSessions struct {
// contains filtered or unexported fields
}
func NewEndSessions(sessionIDs bsoncore.Document) *EndSessions
NewEndSessions constructs and returns a new EndSessions.
func (es *EndSessions) ClusterClock(clock *session.ClusterClock) *EndSessions
ClusterClock sets the cluster clock for this operation.
func (es *EndSessions) CommandMonitor(monitor *event.CommandMonitor) *EndSessions
CommandMonitor sets the monitor to use for APM events.
func (es *EndSessions) Crypt(crypt driver.Crypt) *EndSessions
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (es *EndSessions) Database(database string) *EndSessions
Database sets the database to run this operation against.
func (es *EndSessions) Deployment(deployment driver.Deployment) *EndSessions
Deployment sets the deployment to use for this operation.
func (es *EndSessions) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (es *EndSessions) ServerAPI(serverAPI *driver.ServerAPIOptions) *EndSessions
ServerAPI sets the server API version for this operation.
func (es *EndSessions) ServerSelector(selector description.ServerSelector) *EndSessions
ServerSelector sets the selector used to retrieve a server.
func (es *EndSessions) Session(session *session.Client) *EndSessions
Session sets the session for this operation.
func (es *EndSessions) SessionIDs(sessionIDs bsoncore.Document) *EndSessions
SessionIDs specifies the sessions to be expired.
Find performs a find operation.
type Find struct {
// contains filtered or unexported fields
}
func NewFind(filter bsoncore.Document) *Find
NewFind constructs and returns a new Find.
func (f *Find) AllowDiskUse(allowDiskUse bool) *Find
AllowDiskUse when true allows temporary data to be written to disk during the find command."
func (f *Find) AllowPartialResults(allowPartialResults bool) *Find
AllowPartialResults when true allows partial results to be returned if some shards are down.
func (f *Find) AwaitData(awaitData bool) *Find
AwaitData when true makes a cursor block before returning when no data is available.
func (f *Find) BatchSize(batchSize int32) *Find
BatchSize specifies the number of documents to return in every batch.
func (f *Find) ClusterClock(clock *session.ClusterClock) *Find
ClusterClock sets the cluster clock for this operation.
func (f *Find) Collation(collation bsoncore.Document) *Find
Collation specifies a collation to be used.
func (f *Find) Collection(collection string) *Find
Collection sets the collection that this command will run against.
func (f *Find) CommandMonitor(monitor *event.CommandMonitor) *Find
CommandMonitor sets the monitor to use for APM events.
func (f *Find) Comment(comment string) *Find
Comment sets a string to help trace an operation.
func (f *Find) Crypt(crypt driver.Crypt) *Find
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (f *Find) Database(database string) *Find
Database sets the database to run this operation against.
func (f *Find) Deployment(deployment driver.Deployment) *Find
Deployment sets the deployment to use for this operation.
func (f *Find) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (f *Find) Filter(filter bsoncore.Document) *Find
Filter determines what results are returned from find.
func (f *Find) Hint(hint bsoncore.Value) *Find
Hint specifies the index to use.
func (f *Find) Let(let bsoncore.Document) *Find
Let specifies the let document to use. This option is only valid for server versions 5.0 and above.
func (f *Find) Limit(limit int64) *Find
Limit sets a limit on the number of documents to return.
func (f *Find) Logger(logger *logger.Logger) *Find
Logger sets the logger for this operation.
func (f *Find) Max(max bsoncore.Document) *Find
Max sets an exclusive upper bound for a specific index.
func (f *Find) MaxTime(maxTime *time.Duration) *Find
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (f *Find) Min(min bsoncore.Document) *Find
Min sets an inclusive lower bound for a specific index.
func (f *Find) NoCursorTimeout(noCursorTimeout bool) *Find
NoCursorTimeout when true prevents cursor from timing out after an inactivity period.
func (f *Find) OmitCSOTMaxTimeMS(omit bool) *Find
OmitCSOTMaxTimeMS omits the automatically-calculated "maxTimeMS" from the command when CSOT is enabled. It does not effect "maxTimeMS" set by Find.MaxTime.
func (f *Find) OplogReplay(oplogReplay bool) *Find
OplogReplay when true replays a replica set's oplog.
func (f *Find) Projection(projection bsoncore.Document) *Find
Projection limits the fields returned for all documents.
func (f *Find) ReadConcern(readConcern *readconcern.ReadConcern) *Find
ReadConcern specifies the read concern for this operation.
func (f *Find) ReadPreference(readPreference *readpref.ReadPref) *Find
ReadPreference set the read preference used with this operation.
func (f *Find) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)
Result returns the result of executing this operation.
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 (f *Find) ReturnKey(returnKey bool) *Find
ReturnKey when true returns index keys for all result documents.
func (f *Find) ServerAPI(serverAPI *driver.ServerAPIOptions) *Find
ServerAPI sets the server API version for this operation.
func (f *Find) ServerSelector(selector description.ServerSelector) *Find
ServerSelector sets the selector used to retrieve a server.
func (f *Find) Session(session *session.Client) *Find
Session sets the session for this operation.
func (f *Find) ShowRecordID(showRecordID bool) *Find
ShowRecordID when true adds a $recordId field with the record identifier to returned documents.
func (f *Find) SingleBatch(singleBatch bool) *Find
SingleBatch specifies whether the results should be returned in a single batch.
func (f *Find) Skip(skip int64) *Find
Skip specifies the number of documents to skip before returning.
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 (f *Find) Sort(sort bsoncore.Document) *Find
Sort specifies the order in which to return results.
func (f *Find) Tailable(tailable bool) *Find
Tailable keeps a cursor open and resumable after the last data has been retrieved.
func (f *Find) Timeout(timeout *time.Duration) *Find
Timeout sets the timeout for this operation.
FindAndModify performs a findAndModify operation.
type FindAndModify struct {
// contains filtered or unexported fields
}
func NewFindAndModify(query bsoncore.Document) *FindAndModify
NewFindAndModify constructs and returns a new FindAndModify.
func (fam *FindAndModify) ArrayFilters(arrayFilters bsoncore.Array) *FindAndModify
ArrayFilters specifies an array of filter documents that determines which array elements to modify for an update operation on an array field.
func (fam *FindAndModify) BypassDocumentValidation(bypassDocumentValidation bool) *FindAndModify
BypassDocumentValidation specifies if document validation can be skipped when executing the operation.
func (fam *FindAndModify) ClusterClock(clock *session.ClusterClock) *FindAndModify
ClusterClock sets the cluster clock for this operation.
func (fam *FindAndModify) Collation(collation bsoncore.Document) *FindAndModify
Collation specifies a collation to be used.
func (fam *FindAndModify) Collection(collection string) *FindAndModify
Collection sets the collection that this command will run against.
func (fam *FindAndModify) CommandMonitor(monitor *event.CommandMonitor) *FindAndModify
CommandMonitor sets the monitor to use for APM events.
func (fam *FindAndModify) Comment(comment bsoncore.Value) *FindAndModify
Comment sets a value to help trace an operation.
func (fam *FindAndModify) Crypt(crypt driver.Crypt) *FindAndModify
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (fam *FindAndModify) Database(database string) *FindAndModify
Database sets the database to run this operation against.
func (fam *FindAndModify) Deployment(deployment driver.Deployment) *FindAndModify
Deployment sets the deployment to use for this operation.
func (fam *FindAndModify) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (fam *FindAndModify) Fields(fields bsoncore.Document) *FindAndModify
Fields specifies a subset of fields to return.
func (fam *FindAndModify) Hint(hint bsoncore.Value) *FindAndModify
Hint specifies the index to use.
func (fam *FindAndModify) Let(let bsoncore.Document) *FindAndModify
Let specifies the let document to use. This option is only valid for server versions 5.0 and above.
func (fam *FindAndModify) MaxTime(maxTime *time.Duration) *FindAndModify
MaxTime specifies the maximum amount of time to allow the operation to run on the server.
func (fam *FindAndModify) NewDocument(newDocument bool) *FindAndModify
NewDocument specifies whether to return the modified document or the original. Defaults to false (return original).
func (fam *FindAndModify) Query(query bsoncore.Document) *FindAndModify
Query specifies the selection criteria for the modification.
func (fam *FindAndModify) Remove(remove bool) *FindAndModify
Remove specifies that the matched document should be removed. Defaults to false.
func (fam *FindAndModify) Result() FindAndModifyResult
Result returns the result of executing this operation.
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 (fam *FindAndModify) ServerAPI(serverAPI *driver.ServerAPIOptions) *FindAndModify
ServerAPI sets the server API version for this operation.
func (fam *FindAndModify) ServerSelector(selector description.ServerSelector) *FindAndModify
ServerSelector sets the selector used to retrieve a server.
func (fam *FindAndModify) Session(session *session.Client) *FindAndModify
Session sets the session for this operation.
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 (fam *FindAndModify) Timeout(timeout *time.Duration) *FindAndModify
Timeout sets the timeout for this operation.
func (fam *FindAndModify) Update(update bsoncore.Value) *FindAndModify
Update specifies the update document to perform on the matched document.
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 (fam *FindAndModify) WriteConcern(writeConcern *writeconcern.WriteConcern) *FindAndModify
WriteConcern sets the write concern for this operation.
FindAndModifyResult represents a findAndModify result returned by the server.
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 }
Hello is used to run the handshake operation.
type Hello struct {
// contains filtered or unexported fields
}
func NewHello() *Hello
NewHello constructs a Hello.
func (h *Hello) AppName(appname string) *Hello
AppName sets the application name in the client metadata sent in this operation.
func (h *Hello) ClusterClock(clock *session.ClusterClock) *Hello
ClusterClock sets the cluster clock for this operation.
func (h *Hello) Compressors(compressors []string) *Hello
Compressors sets the compressors that can be used.
func (h *Hello) Deployment(d driver.Deployment) *Hello
Deployment sets the Deployment for this operation.
func (h *Hello) Execute(ctx context.Context) error
Execute runs this operation.
func (h *Hello) FinishHandshake(context.Context, driver.Connection) error
FinishHandshake implements the Handshaker interface. This is a no-op function because a non-authenticated connection does not do anything besides the initial Hello for a handshake.
func (h *Hello) GetHandshakeInformation(ctx context.Context, _ address.Address, c driver.Connection) (driver.HandshakeInformation, error)
GetHandshakeInformation performs the MongoDB handshake for the provided connection and returns the relevant information about the server. This function implements the driver.Handshaker interface.
func (h *Hello) LoadBalanced(lb bool) *Hello
LoadBalanced specifies whether or not this operation is being sent over a connection to a load balanced cluster.
func (h *Hello) MaxAwaitTimeMS(awaitTime int64) *Hello
MaxAwaitTimeMS sets the maximum time for the server to wait for topology changes during a heartbeat.
func (h *Hello) Result(addr address.Address) description.Server
Result returns the result of executing this operation.
func (h *Hello) SASLSupportedMechs(username string) *Hello
SASLSupportedMechs retrieves the supported SASL mechanism for the given user when this operation is run.
func (h *Hello) ServerAPI(serverAPI *driver.ServerAPIOptions) *Hello
ServerAPI sets the server API version for this operation.
func (h *Hello) SpeculativeAuthenticate(doc bsoncore.Document) *Hello
SpeculativeAuthenticate sets the document to be used for speculative authentication.
func (h *Hello) StreamResponse(ctx context.Context, conn driver.StreamerConnection) error
StreamResponse gets the next streaming Hello response from the server.
func (h *Hello) TopologyVersion(tv *description.TopologyVersion) *Hello
TopologyVersion sets the TopologyVersion to be used for heartbeats.
Insert performs an insert operation.
type Insert struct {
// contains filtered or unexported fields
}
func NewInsert(documents ...bsoncore.Document) *Insert
NewInsert constructs and returns a new Insert.
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 (i *Insert) ClusterClock(clock *session.ClusterClock) *Insert
ClusterClock sets the cluster clock for this operation.
func (i *Insert) Collection(collection string) *Insert
Collection sets the collection that this command will run against.
func (i *Insert) CommandMonitor(monitor *event.CommandMonitor) *Insert
CommandMonitor sets the monitor to use for APM events.
func (i *Insert) Comment(comment bsoncore.Value) *Insert
Comment sets a value to help trace an operation.
func (i *Insert) Crypt(crypt driver.Crypt) *Insert
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (i *Insert) Database(database string) *Insert
Database sets the database to run this operation against.
func (i *Insert) Deployment(deployment driver.Deployment) *Insert
Deployment sets the deployment to use for this operation.
func (i *Insert) Documents(documents ...bsoncore.Document) *Insert
Documents adds documents to this operation that will be inserted when this operation is executed.
func (i *Insert) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (i *Insert) Logger(logger *logger.Logger) *Insert
Logger sets the logger for this operation.
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 (i *Insert) Result() InsertResult
Result returns the result of executing this operation.
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 (i *Insert) ServerAPI(serverAPI *driver.ServerAPIOptions) *Insert
ServerAPI sets the server API version for this operation.
func (i *Insert) ServerSelector(selector description.ServerSelector) *Insert
ServerSelector sets the selector used to retrieve a server.
func (i *Insert) Session(session *session.Client) *Insert
Session sets the session for this operation.
func (i *Insert) Timeout(timeout *time.Duration) *Insert
Timeout sets the timeout for this operation.
func (i *Insert) WriteConcern(writeConcern *writeconcern.WriteConcern) *Insert
WriteConcern sets the write concern for this operation.
InsertResult represents an insert result returned by the server.
type InsertResult struct { // Number of documents successfully inserted. N int64 }
LastErrorObject represents information about updates and upserts returned by the server.
type LastErrorObject struct { // True if an update modified an existing document UpdatedExisting bool // Object ID of the upserted document. Upserted interface{} }
ListCollections performs a listCollections operation.
type ListCollections struct {
// contains filtered or unexported fields
}
func NewListCollections(filter bsoncore.Document) *ListCollections
NewListCollections constructs and returns a new ListCollections.
func (lc *ListCollections) AuthorizedCollections(authorizedCollections bool) *ListCollections
AuthorizedCollections specifies whether to only return collections the user is authorized to use.
func (lc *ListCollections) BatchSize(batchSize int32) *ListCollections
BatchSize specifies the number of documents to return in every batch.
func (lc *ListCollections) ClusterClock(clock *session.ClusterClock) *ListCollections
ClusterClock sets the cluster clock for this operation.
func (lc *ListCollections) CommandMonitor(monitor *event.CommandMonitor) *ListCollections
CommandMonitor sets the monitor to use for APM events.
func (lc *ListCollections) Crypt(crypt driver.Crypt) *ListCollections
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (lc *ListCollections) Database(database string) *ListCollections
Database sets the database to run this operation against.
func (lc *ListCollections) Deployment(deployment driver.Deployment) *ListCollections
Deployment sets the deployment to use for this operation.
func (lc *ListCollections) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (lc *ListCollections) Filter(filter bsoncore.Document) *ListCollections
Filter determines what results are returned from listCollections.
func (lc *ListCollections) NameOnly(nameOnly bool) *ListCollections
NameOnly specifies whether to only return collection names.
func (lc *ListCollections) ReadPreference(readPreference *readpref.ReadPref) *ListCollections
ReadPreference set the read preference used with this operation.
func (lc *ListCollections) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)
Result returns the result of executing this operation.
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 (lc *ListCollections) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListCollections
ServerAPI sets the server API version for this operation.
func (lc *ListCollections) ServerSelector(selector description.ServerSelector) *ListCollections
ServerSelector sets the selector used to retrieve a server.
func (lc *ListCollections) Session(session *session.Client) *ListCollections
Session sets the session for this operation.
func (lc *ListCollections) Timeout(timeout *time.Duration) *ListCollections
Timeout sets the timeout for this operation.
ListDatabases performs a listDatabases operation.
type ListDatabases struct {
// contains filtered or unexported fields
}
func NewListDatabases(filter bsoncore.Document) *ListDatabases
NewListDatabases constructs and returns a new ListDatabases.
func (ld *ListDatabases) AuthorizedDatabases(authorizedDatabases bool) *ListDatabases
AuthorizedDatabases specifies whether to only return databases which the user is authorized to use."
func (ld *ListDatabases) ClusterClock(clock *session.ClusterClock) *ListDatabases
ClusterClock sets the cluster clock for this operation.
func (ld *ListDatabases) CommandMonitor(monitor *event.CommandMonitor) *ListDatabases
CommandMonitor sets the monitor to use for APM events.
func (ld *ListDatabases) Crypt(crypt driver.Crypt) *ListDatabases
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (ld *ListDatabases) Database(database string) *ListDatabases
Database sets the database to run this operation against.
func (ld *ListDatabases) Deployment(deployment driver.Deployment) *ListDatabases
Deployment sets the deployment to use for this operation.
func (ld *ListDatabases) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (ld *ListDatabases) Filter(filter bsoncore.Document) *ListDatabases
Filter determines what results are returned from listDatabases.
func (ld *ListDatabases) NameOnly(nameOnly bool) *ListDatabases
NameOnly specifies whether to only return database names.
func (ld *ListDatabases) ReadPreference(readPreference *readpref.ReadPref) *ListDatabases
ReadPreference set the read preference used with this operation.
func (ld *ListDatabases) Result() ListDatabasesResult
Result returns the result of executing this operation.
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 (ld *ListDatabases) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListDatabases
ServerAPI sets the server API version for this operation.
func (ld *ListDatabases) ServerSelector(selector description.ServerSelector) *ListDatabases
ServerSelector sets the selector used to retrieve a server.
func (ld *ListDatabases) Session(session *session.Client) *ListDatabases
Session sets the session for this operation.
func (ld *ListDatabases) Timeout(timeout *time.Duration) *ListDatabases
Timeout sets the timeout for this operation.
ListDatabasesResult represents a listDatabases result returned by the server.
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 }
ListIndexes performs a listIndexes operation.
type ListIndexes struct {
// contains filtered or unexported fields
}
func NewListIndexes() *ListIndexes
NewListIndexes constructs and returns a new ListIndexes.
func (li *ListIndexes) BatchSize(batchSize int32) *ListIndexes
BatchSize specifies the number of documents to return in every batch.
func (li *ListIndexes) ClusterClock(clock *session.ClusterClock) *ListIndexes
ClusterClock sets the cluster clock for this operation.
func (li *ListIndexes) Collection(collection string) *ListIndexes
Collection sets the collection that this command will run against.
func (li *ListIndexes) CommandMonitor(monitor *event.CommandMonitor) *ListIndexes
CommandMonitor sets the monitor to use for APM events.
func (li *ListIndexes) Crypt(crypt driver.Crypt) *ListIndexes
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (li *ListIndexes) Database(database string) *ListIndexes
Database sets the database to run this operation against.
func (li *ListIndexes) Deployment(deployment driver.Deployment) *ListIndexes
Deployment sets the deployment to use for this operation.
func (li *ListIndexes) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (li *ListIndexes) MaxTime(maxTime *time.Duration) *ListIndexes
MaxTime specifies the maximum amount of time to allow the query to run on the server.
func (li *ListIndexes) Result(opts driver.CursorOptions) (*driver.BatchCursor, error)
Result returns the result of executing this operation.
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 (li *ListIndexes) ServerAPI(serverAPI *driver.ServerAPIOptions) *ListIndexes
ServerAPI sets the server API version for this operation.
func (li *ListIndexes) ServerSelector(selector description.ServerSelector) *ListIndexes
ServerSelector sets the selector used to retrieve a server.
func (li *ListIndexes) Session(session *session.Client) *ListIndexes
Session sets the session for this operation.
func (li *ListIndexes) Timeout(timeout *time.Duration) *ListIndexes
Timeout sets the timeout for this operation.
Update performs an update operation.
type Update struct {
// contains filtered or unexported fields
}
func NewUpdate(updates ...bsoncore.Document) *Update
NewUpdate constructs and returns a new Update.
func (u *Update) ArrayFilters(arrayFilters bool) *Update
ArrayFilters is a flag to indicate that the update document contains an arrayFilters field. This option is only supported on server versions 3.6 and higher. For servers < 3.6, the driver will return an error.
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 (u *Update) ClusterClock(clock *session.ClusterClock) *Update
ClusterClock sets the cluster clock for this operation.
func (u *Update) Collection(collection string) *Update
Collection sets the collection that this command will run against.
func (u *Update) CommandMonitor(monitor *event.CommandMonitor) *Update
CommandMonitor sets the monitor to use for APM events.
func (u *Update) Comment(comment bsoncore.Value) *Update
Comment sets a value to help trace an operation.
func (u *Update) Crypt(crypt driver.Crypt) *Update
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (u *Update) Database(database string) *Update
Database sets the database to run this operation against.
func (u *Update) Deployment(deployment driver.Deployment) *Update
Deployment sets the deployment to use for this operation.
func (u *Update) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (u *Update) Hint(hint bool) *Update
Hint is a flag to indicate that the update document contains a hint. Hint is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using the hint option. For servers < 3.4, the driver will return an error if the hint option is used.
func (u *Update) Let(let bsoncore.Document) *Update
Let specifies the let document to use. This option is only valid for server versions 5.0 and above.
func (u *Update) Logger(logger *logger.Logger) *Update
Logger sets the logger for this operation.
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 (u *Update) Result() UpdateResult
Result returns the result of executing this operation.
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 (u *Update) ServerAPI(serverAPI *driver.ServerAPIOptions) *Update
ServerAPI sets the server API version for this operation.
func (u *Update) ServerSelector(selector description.ServerSelector) *Update
ServerSelector sets the selector used to retrieve a server.
func (u *Update) Session(session *session.Client) *Update
Session sets the session for this operation.
func (u *Update) Timeout(timeout *time.Duration) *Update
Timeout sets the timeout for this operation.
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>, hint: Optional<string/Document>}.
func (u *Update) WriteConcern(writeConcern *writeconcern.WriteConcern) *Update
WriteConcern sets the write concern for this operation.
UpdateResult contains information for the result of an Update operation.
type UpdateResult struct { // Number of documents matched. N int64 // Number of documents modified. NModified int64 // Information about upserted documents. Upserted []Upsert }
UpdateSearchIndex performs a updateSearchIndex operation.
type UpdateSearchIndex struct {
// contains filtered or unexported fields
}
func NewUpdateSearchIndex(index string, definition bsoncore.Document) *UpdateSearchIndex
NewUpdateSearchIndex constructs and returns a new UpdateSearchIndex.
func (usi *UpdateSearchIndex) ClusterClock(clock *session.ClusterClock) *UpdateSearchIndex
ClusterClock sets the cluster clock for this operation.
func (usi *UpdateSearchIndex) Collection(collection string) *UpdateSearchIndex
Collection sets the collection that this command will run against.
func (usi *UpdateSearchIndex) CommandMonitor(monitor *event.CommandMonitor) *UpdateSearchIndex
CommandMonitor sets the monitor to use for APM events.
func (usi *UpdateSearchIndex) Crypt(crypt driver.Crypt) *UpdateSearchIndex
Crypt sets the Crypt object to use for automatic encryption and decryption.
func (usi *UpdateSearchIndex) Database(database string) *UpdateSearchIndex
Database sets the database to run this operation against.
func (usi *UpdateSearchIndex) Definition(definition bsoncore.Document) *UpdateSearchIndex
Definition specifies the definition for the document being created.
func (usi *UpdateSearchIndex) Deployment(deployment driver.Deployment) *UpdateSearchIndex
Deployment sets the deployment to use for this operation.
func (usi *UpdateSearchIndex) Execute(ctx context.Context) error
Execute runs this operations and returns an error if the operation did not execute successfully.
func (usi *UpdateSearchIndex) Index(name string) *UpdateSearchIndex
Index specifies the index of the document being updated.
func (usi *UpdateSearchIndex) Result() UpdateSearchIndexResult
Result returns the result of executing this operation.
func (usi *UpdateSearchIndex) ServerAPI(serverAPI *driver.ServerAPIOptions) *UpdateSearchIndex
ServerAPI sets the server API version for this operation.
func (usi *UpdateSearchIndex) ServerSelector(selector description.ServerSelector) *UpdateSearchIndex
ServerSelector sets the selector used to retrieve a server.
func (usi *UpdateSearchIndex) Session(session *session.Client) *UpdateSearchIndex
Session sets the session for this operation.
func (usi *UpdateSearchIndex) Timeout(timeout *time.Duration) *UpdateSearchIndex
Timeout sets the timeout for this operation.
func (usi *UpdateSearchIndex) WriteConcern(writeConcern *writeconcern.WriteConcern) *UpdateSearchIndex
WriteConcern sets the write concern for this operation.
UpdateSearchIndexResult represents a single index in the updateSearchIndexResult result.
type UpdateSearchIndexResult struct { Ok int32 }
Upsert contains the information for an upsert in an Update operation.
type Upsert struct { Index int64 ID interface{} `bson:"_id"` }