Versions in this module Expand all Collapse all v2 v2.3.0 Sep 5, 2025 Changes in this version + const TestDb + var LocalRc = readconcern.Local() + var MajorityRc = readconcern.Majority() + var MajorityWc = writeconcern.Majority() + var PrimaryRp = readpref.Primary() + var SecondaryRp = readpref.Secondary() + func AuthEnabled() bool + func ClusterConnString() *connstring.ConnString + func ClusterURI() string + func CompareServerVersions(v1 string, v2 string) int + func CreateCommandErrorResponse(ce CommandError) bson.D + func CreateCursorResponse(cursorID int64, ns string, identifier BatchIdentifier, batch ...bson.D) bson.D + func CreateSuccessResponse(elems ...bson.E) bson.D + func CreateWriteConcernErrorResponse(wce WriteConcernError) bson.D + func CreateWriteErrorsResponse(writeErrorrs ...WriteError) bson.D + func DropEncryptedCollection(t *T, coll *mongo.Collection, encryptedFields any) + func GlobalClient() *mongo.Client + func GlobalTopology() *topology.Topology + func IsCSFLEEnabled() bool + func MultiMongosLoadBalancerURI() string + func SSLEnabled() bool + func ServerVersion() string + func Serverless() bool + func SetFailPoint(fp failpoint.FailPoint, client *mongo.Client) error + func SetRawFailPoint(fp bson.Raw, client *mongo.Client) error + func Setup(setupOpts ...*SetupOptions) error + func SingleMongosLoadBalancerURI() string + func Teardown() error + type BatchIdentifier string + const FirstBatch + const NextBatch + type ClientType int + const Default + const Mock + const Pinned + const Proxy + type Collection struct + Client *mongo.Client + CreateOpts *options.CreateCollectionOptionsBuilder + DB string + Name string + Opts *options.CollectionOptionsBuilder + ViewOn string + ViewPipeline any + type CommandError struct + Code int32 + Labels []string + Message string + Name string + type Options struct + func NewOptions() *Options + func (op *Options) AtlasDataLake(adl bool) *Options + func (op *Options) Auth(auth bool) *Options + func (op *Options) ClientOptions(opts *options.ClientOptions) *Options + func (op *Options) ClientType(ct ClientType) *Options + func (op *Options) CollectionCreateOptions(opts *options.CreateCollectionOptionsBuilder) *Options + func (op *Options) CollectionName(collName string) *Options + func (op *Options) CollectionOptions(opts *options.CollectionOptionsBuilder) *Options + func (op *Options) CreateClient(create bool) *Options + func (op *Options) CreateCollection(create bool) *Options + func (op *Options) DatabaseName(dbName string) *Options + func (op *Options) Enterprise(ent bool) *Options + func (op *Options) MaxServerVersion(version string) *Options + func (op *Options) MinServerVersion(version string) *Options + func (op *Options) MockResponses(responses ...bson.D) *Options + func (op *Options) RequireAPIVersion(rav bool) *Options + func (op *Options) RunOn(blocks ...RunOnBlock) *Options + func (op *Options) SSL(ssl bool) *Options + func (op *Options) ShareClient(share bool) *Options + func (op *Options) Topologies(topos ...TopologyKind) *Options + type ProxyMessage struct + CommandName string + Received *ReceivedMessage + Sent *SentMessage + ServerAddress string + type ReceivedMessage struct + RawMessage wiremessage.WireMessage + Response bsoncore.Document + ResponseTo int32 + type RunOnBlock struct + Auth *bool + AuthEnabled *bool + CSFLE *bool + MaxServerVersion string + MinServerVersion string + ServerParameters map[string]bson.RawValue + Serverless string + Topology []TopologyKind + func (r *RunOnBlock) UnmarshalBSON(data []byte) error + type SentMessage struct + Batch *bsoncore.Iterator + Command bsoncore.Document + OpCode wiremessage.OpCode + RawMessage wiremessage.WireMessage + ReadPreference bsoncore.Document + RequestID int32 + type SetupOptions struct + URI *string + func NewSetupOptions() *SetupOptions + func (so *SetupOptions) SetURI(uri string) *SetupOptions + type T struct + Client *mongo.Client + Coll *mongo.Collection + DB *mongo.Database + func New(wrapped *testing.T, opts ...*Options) *T + func (t *T) AddMockResponses(responses ...bson.D) + func (t *T) ClearCollections() + func (t *T) ClearEvents() + func (t *T) ClearFailPoints() + func (t *T) ClearMockResponses() + func (t *T) CloneCollection(opts *options.CollectionOptionsBuilder) + func (t *T) CloneDatabase(opts *options.DatabaseOptionsBuilder) + func (t *T) CreateCollection(coll Collection, createOnServer bool) *mongo.Collection + func (t *T) FilterFailedEvents(filter func(*event.CommandFailedEvent) bool) + func (t *T) FilterStartedEvents(filter func(*event.CommandStartedEvent) bool) + func (t *T) FilterSucceededEvents(filter func(*event.CommandSucceededEvent) bool) + func (t *T) GetAllFailedEvents() []*event.CommandFailedEvent + func (t *T) GetAllStartedEvents() []*event.CommandStartedEvent + func (t *T) GetAllSucceededEvents() []*event.CommandSucceededEvent + func (t *T) GetFailedEvent() *event.CommandFailedEvent + func (t *T) GetProxiedMessages() []*ProxyMessage + func (t *T) GetStartedEvent() *event.CommandStartedEvent + func (t *T) GetSucceededEvent() *event.CommandSucceededEvent + func (t *T) NumberConnectionsCheckedOut() int + func (t *T) ResetClient(opts *options.ClientOptions) + func (t *T) Run(name string, callback func(mt *T)) + func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) + func (t *T) SetFailPoint(fp failpoint.FailPoint) + func (t *T) SetFailPointFromDocument(fp bson.Raw) + func (t *T) TrackFailPoint(fpName string) + type TopologyKind string + const LoadBalanced + const ReplicaSet + const Sharded + const ShardedReplicaSet + const Single + func ClusterTopologyKind() TopologyKind + type WriteConcernError struct + Code int + Details bson.Raw + Message string + Name string + type WriteError struct + Code int + Index int + Message string