Versions in this module Expand all Collapse all v2 v2.0.0 Dec 10, 2024 Changes in this version + const LegacyNotPrimaryErrMsg + const TestServerAPIVersion + var ErrCursorNotFound = errors.New("cursor not found") + var ErrDeadlineWouldBeExceeded = fmt.Errorf("operation not sent to server, as Timeout would be exceeded: %w", ...) + var ErrDocumentTooLarge = errors.New("an inserted document is too large") + var ErrEmptyReadConcern = errors.New("a read concern must have at least one field set") + var ErrEmptyWriteConcern = errors.New("a write concern must have at least one field set") + var ErrMultiDocCommandResponse = errors.New("command returned multiple documents") + var ErrNoCursor = errors.New("database response does not contain a cursor") + var ErrNoDocCommandResponse = errors.New("command returned no documents") + var ErrNonPrimaryReadPref = errors.New("read preference in a transaction must be primary") + var ErrReplyDocumentMismatch = errors.New("number of documents returned does not match numberReturned field") + var ErrUnacknowledgedWrite = errors.New("unacknowledged write") + var ErrUnsupportedStorageEngine = errors.New(...) + var NetworkError = "NetworkError" + var NoWritesPerformed = "NoWritesPerformed" + var RetryableWriteError = "RetryableWriteError" + var TransientTransactionError = "TransientTransactionError" + var UnknownTransactionCommitResult = "UnknownTransactionCommitResult" + func CompressPayload(in []byte, opts CompressionOpts) ([]byte, error) + func DecompressPayload(in []byte, opts CompressionOpts) ([]byte, error) + func ExtractErrorFromServerResponse(doc bsoncore.Document) error + func MarshalBSONReadConcern(rc *readconcern.ReadConcern) (bson.Type, []byte, error) + func MarshalBSONWriteConcern(wc *writeconcern.WriteConcern, wtimeout time.Duration) (bson.Type, []byte, error) + type AuthConfig struct + ClusterClock *session.ClusterClock + Connection *mnet.Connection + Description description.Server + HandshakeInfo HandshakeInformation + ServerAPI *ServerAPIOptions + type Authenticator interface + Auth func(context.Context, *AuthConfig) error + Reauth func(context.Context, *AuthConfig) error + type BatchCursor struct + func NewBatchCursor(cr CursorResponse, clientSession *session.Client, clock *session.ClusterClock, ...) (*BatchCursor, error) + func NewBatchCursorFromList(array []byte) *BatchCursor + func NewEmptyBatchCursor() *BatchCursor + func (bc *BatchCursor) Batch() *bsoncore.Iterator + func (bc *BatchCursor) Close(ctx context.Context) error + func (bc *BatchCursor) Err() error + func (bc *BatchCursor) ID() int64 + func (bc *BatchCursor) KillCursor(ctx context.Context) error + func (bc *BatchCursor) Next(ctx context.Context) bool + func (bc *BatchCursor) PostBatchResumeToken() bsoncore.Document + func (bc *BatchCursor) Server() Server + func (bc *BatchCursor) SetBatchSize(size int32) + func (bc *BatchCursor) SetComment(comment interface{}) + func (bc *BatchCursor) SetMaxAwaitTime(dur time.Duration) + type Batches struct + Current []bsoncore.Document + Documents []bsoncore.Document + Identifier string + Ordered *bool + func (b *Batches) AdvanceBatch(maxCount, targetBatchSize, maxDocSize int) error + func (b *Batches) ClearBatch() + func (b *Batches) Valid() bool + type CollectionInfoFn func(ctx context.Context, db string, filter bsoncore.Document) (bsoncore.Document, error) + type CompressionOpts struct + Compressor wiremessage.CompressorID + UncompressedSize int32 + ZlibLevel int + ZstdLevel int + type Connector interface + Connect func() error + type Cred struct + OIDCHumanCallback OIDCCallback + OIDCMachineCallback OIDCCallback + Password string + PasswordSet bool + Props map[string]string + Source string + Username string + type Crypt interface + BypassAutoEncryption func() bool + Close func() + CreateDataKey func(ctx context.Context, kmsProvider string, opts *options.DataKeyOptions) (bsoncore.Document, error) + Decrypt func(ctx context.Context, cmdResponse bsoncore.Document) (bsoncore.Document, error) + DecryptExplicit func(ctx context.Context, subtype byte, data []byte) (bsoncore.Value, error) + Encrypt func(ctx context.Context, db string, cmd bsoncore.Document) (bsoncore.Document, error) + EncryptExplicit func(ctx context.Context, val bsoncore.Value, ...) (byte, []byte, error) + EncryptExplicitExpression func(ctx context.Context, val bsoncore.Document, ...) (bsoncore.Document, error) + RewrapDataKey func(ctx context.Context, filter []byte, opts *options.RewrapManyDataKeyOptions) ([]bsoncore.Document, error) + func NewCrypt(opts *CryptOptions) Crypt + type CryptOptions struct + BypassAutoEncryption bool + BypassQueryAnalysis bool + CollInfoFn CollectionInfoFn + KeyFn KeyRetrieverFn + MarkFn MarkCommandFn + MongoCrypt *mongocrypt.MongoCrypt + TLSConfig map[string]*tls.Config + type CursorOptions struct + BatchSize int32 + CommandMonitor *event.CommandMonitor + Comment bsoncore.Value + Crypt Crypt + Limit int32 + MarshalValueEncoderFn func(io.Writer) *bson.Encoder + MaxAwaitTime *time.Duration + ServerAPI *ServerAPIOptions + func (cursorOptions *CursorOptions) SetMaxAwaitTime(dur time.Duration) + type CursorResponse struct + Collection string + Connection *mnet.Connection + Database string + Desc description.Server + ErrorProcessor ErrorProcessor + FirstBatch *bsoncore.Iterator + ID int64 + Server Server + func NewCursorResponse(info ResponseInfo) (CursorResponse, error) + type Deployment interface + GetServerSelectionTimeout func() time.Duration + Kind func() description.TopologyKind + SelectServer func(context.Context, description.ServerSelector) (Server, error) + type Disconnector interface + Disconnect func(context.Context) error + type Error struct + Code int32 + Labels []string + Message string + Name string + Raw bsoncore.Document + TopologyVersion *description.TopologyVersion + Wrapped error + func (e Error) Error() string + func (e Error) HasErrorLabel(label string) bool + func (e Error) NamespaceNotFound() bool + func (e Error) NetworkError() bool + func (e Error) NodeIsRecovering() bool + func (e Error) NodeIsShuttingDown() bool + func (e Error) NotPrimary() bool + func (e Error) RetryableRead() bool + func (e Error) RetryableWrite(wireVersion *description.VersionRange) bool + func (e Error) UnsupportedStorageEngine() bool + func (e Error) Unwrap() error + type ErrorProcessor interface + ProcessError func(err error, desc mnet.Describer) ProcessErrorResult + type Expirable interface + Alive func() bool + Expire func() error + type HandshakeInformation struct + Description description.Server + SaslSupportedMechs []string + ServerConnectionID *int64 + SpeculativeAuthenticate bsoncore.Document + type Handshaker interface + FinishHandshake func(context.Context, *mnet.Connection) error + GetHandshakeInformation func(context.Context, address.Address, *mnet.Connection) (HandshakeInformation, error) + type IDPInfo struct + ClientID string + Issuer string + RequestScopes []string + type InvalidOperationError struct + MissingField string + func (err InvalidOperationError) Error() string + type KeyRetrieverFn func(ctx context.Context, filter bsoncore.Document) ([]bsoncore.Document, error) + type LegacyOperationKind uint + const LegacyFind + const LegacyGetMore + const LegacyHandshake + const LegacyKillCursors + const LegacyListCollections + const LegacyListIndexes + const LegacyNone + type LocalAddresser interface + LocalAddress func() address.Address + type MarkCommandFn func(ctx context.Context, db string, cmd bsoncore.Document) (bsoncore.Document, error) + type OIDCArgs struct + IDPInfo *IDPInfo + RefreshToken *string + Version int + type OIDCCallback func(context.Context, *OIDCArgs) (*OIDCCredential, error) + type OIDCCredential struct + AccessToken string + ExpiresAt *time.Time + RefreshToken *string + type Operation struct + Authenticator Authenticator + Batches *Batches + Client *session.Client + Clock *session.ClusterClock + CommandFn func(dst []byte, desc description.SelectedServer) ([]byte, error) + CommandMonitor *event.CommandMonitor + Crypt Crypt + Database string + Deployment Deployment + IsOutputAggregate bool + Legacy LegacyOperationKind + Logger *logger.Logger + MinimumReadConcernWireVersion int32 + MinimumWriteConcernWireVersion int32 + Name string + OmitMaxTimeMS bool + ProcessResponseFn func(ResponseInfo) error + ReadConcern *readconcern.ReadConcern + ReadPreference *readpref.ReadPref + RetryMode *RetryMode + Selector description.ServerSelector + ServerAPI *ServerAPIOptions + Timeout *time.Duration + Type Type + WriteConcern *writeconcern.WriteConcern + func (op Operation) Execute(ctx context.Context) error + func (op Operation) ExecuteExhaust(ctx context.Context, conn *mnet.Connection) error + func (op Operation) Validate() error + type ProcessErrorResult int + const ConnectionPoolCleared + const NoChange + const ServerMarkedUnknown + type QueryFailureError struct + Message string + Response bsoncore.Document + Wrapped error + func (e QueryFailureError) Error() string + func (e QueryFailureError) Unwrap() error + type RTTMonitor interface + EWMA func() time.Duration + Min func() time.Duration + Stats func() string + type ResponseError struct + Message string + Wrapped error + func NewCommandResponseError(msg string, err error) ResponseError + func (e ResponseError) Error() string + type ResponseInfo struct + Connection *mnet.Connection + ConnectionDescription description.Server + CurrentIndex int + Server Server + ServerResponse bsoncore.Document + type RetryMode uint + const RetryContext + const RetryNone + const RetryOnce + const RetryOncePerCommand + func (rm RetryMode) Enabled() bool + type RetryablePoolError interface + Retryable func() bool + type Server interface + Connection func(context.Context) (*mnet.Connection, error) + RTTMonitor func() RTTMonitor + type ServerAPIOptions struct + DeprecationErrors *bool + ServerAPIVersion string + Strict *bool + func NewServerAPIOptions(serverAPIVersion string) *ServerAPIOptions + func (s *ServerAPIOptions) SetDeprecationErrors(deprecationErrors bool) *ServerAPIOptions + func (s *ServerAPIOptions) SetStrict(strict bool) *ServerAPIOptions + type SingleConnectionDeployment struct + C *mnet.Connection + func (SingleConnectionDeployment) GetServerSelectionTimeout() time.Duration + func (SingleConnectionDeployment) Kind() description.TopologyKind + func (scd SingleConnectionDeployment) Connection(context.Context) (*mnet.Connection, error) + func (scd SingleConnectionDeployment) RTTMonitor() RTTMonitor + func (scd SingleConnectionDeployment) SelectServer(context.Context, description.ServerSelector) (Server, error) + type SingleServerDeployment struct + func (SingleServerDeployment) GetServerSelectionTimeout() time.Duration + func (SingleServerDeployment) Kind() description.TopologyKind + func (ssd SingleServerDeployment) SelectServer(context.Context, description.ServerSelector) (Server, error) + type Subscriber interface + Subscribe func() (*Subscription, error) + Unsubscribe func(*Subscription) error + type Subscription struct + ID uint64 + Updates <-chan description.Topology + type Type uint + const Read + const Write + type WriteCommandError struct + Labels []string + Raw bsoncore.Document + WriteConcernError *WriteConcernError + WriteErrors WriteErrors + func (wce WriteCommandError) Error() string + func (wce WriteCommandError) HasErrorLabel(label string) bool + func (wce WriteCommandError) Retryable(wireVersion *description.VersionRange) bool + func (wce WriteCommandError) UnsupportedStorageEngine() bool + type WriteConcernError struct + Code int64 + Details bsoncore.Document + Labels []string + Message string + Name string + Raw bsoncore.Document + TopologyVersion *description.TopologyVersion + func (wce WriteConcernError) Error() string + func (wce WriteConcernError) NodeIsRecovering() bool + func (wce WriteConcernError) NodeIsShuttingDown() bool + func (wce WriteConcernError) NotPrimary() bool + func (wce WriteConcernError) Retryable() bool + type WriteError struct + Code int64 + Details bsoncore.Document + Index int64 + Message string + Raw bsoncore.Document + func (we WriteError) Error() string + type WriteErrors []WriteError + func (we WriteErrors) Error() string v2.0.0-beta2 Sep 18, 2024 v2.0.0-beta1 Jul 26, 2024 v2.0.0-alpha2 Jul 26, 2024 Other modules containing this package go.mongodb.org/mongo-driver