Versions in this module Expand all Collapse all v1 v1.4.3 Nov 17, 2021 v1.4.2 Nov 17, 2021 Changes in this version + const DefaultTestPort + const DisableSocketTimeout + const ErrConnectionRefusedSuffix + const ErrCouldNotContactPrimaryPrefix + const ErrCouldNotFindPrimaryPrefix + const ErrDuplicateKeyCode + const ErrFailedDocumentValidation + const ErrLostConnection + const ErrNoReachableServers + const ErrNotMaster + const ErrNsNotFound + const ErrReplTimeoutPrefix + const ErrUnableToTargetPrefix + const ErrUnacknowledgedWrite + const ErrWriteResultsUnavailable + const LogReplay + const MaxBSONSize + const Mongos + const Monotonic + const None + const Prefetch + const ReplSet + const Snapshot + const Standalone + const Unknown + const WarningNonPrimaryMongosConnection + func ApplyFlags(opts *mopt.FindOneOptions, flags int) + func CanIgnoreError(err error) bool + func FilterError(stopOnError bool, err error) error + func GetCollections(database *mongo.Database, name string) (*mongo.Cursor, error) + func GetIndexes(coll *mongo.Collection) (*mongo.Cursor, error) + func IsMMAPV1(database *mongo.Database, collectionName string) (bool, error) + func NewMongoWriteConcern(writeConcern string, cs *connstring.ConnString) (wc *writeconcern.WriteConcern, err error) + func NewReadPreference(rp string, cs *connstring.ConnString) (*readpref.ReadPref, error) + func OpTimeEquals(lhs OpTime, rhs OpTime) bool + func OpTimeGreaterThan(lhs OpTime, rhs OpTime) bool + func OpTimeIsEmpty(opTime OpTime) bool + func OpTimeLessThan(lhs OpTime, rhs OpTime) bool + func StripDBFromNamespace(namespace string, dbName string) (string, error) + type ApplyOpsResponse struct + ErrMsg string + Ok bool + type BSONSource struct + MaxBSONSize int32 + Stream io.ReadCloser + func NewBSONSource(in io.ReadCloser) *BSONSource + func NewBufferlessBSONSource(in io.ReadCloser) *BSONSource + func (bs *BSONSource) Close() error + func (bs *BSONSource) Err() error + func (bs *BSONSource) LoadNext() []byte + func (bs *BSONSource) SetMaxBSONSize(size int32) + type BufferedBulkInserter struct + func NewOrderedBufferedBulkInserter(collection *mongo.Collection, docLimit int) *BufferedBulkInserter + func NewUnorderedBufferedBulkInserter(collection *mongo.Collection, docLimit int) *BufferedBulkInserter + func (bb *BufferedBulkInserter) Delete(selector, replacement bson.D) (*mongo.BulkWriteResult, error) + func (bb *BufferedBulkInserter) Flush() (*mongo.BulkWriteResult, error) + func (bb *BufferedBulkInserter) Insert(doc interface{}) (*mongo.BulkWriteResult, error) + func (bb *BufferedBulkInserter) InsertRaw(rawBytes []byte) (*mongo.BulkWriteResult, error) + func (bb *BufferedBulkInserter) Replace(selector, replacement bson.D) (*mongo.BulkWriteResult, error) + func (bb *BufferedBulkInserter) SetBypassDocumentValidation(bypass bool) *BufferedBulkInserter + func (bb *BufferedBulkInserter) SetOrdered(ordered bool) *BufferedBulkInserter + func (bb *BufferedBulkInserter) SetUpsert(upsert bool) *BufferedBulkInserter + func (bb *BufferedBulkInserter) Update(selector, update bson.D) (*mongo.BulkWriteResult, error) + type CollectionInfo struct + Info bson.M + Name string + Options bson.M + Type string + func GetCollectionInfo(coll *mongo.Collection) (*CollectionInfo, error) + func (ci *CollectionInfo) GetUUID() string + func (ci *CollectionInfo) IsSystemCollection() bool + func (ci *CollectionInfo) IsTimeseries() bool + func (ci *CollectionInfo) IsView() bool + type CommandRunner interface + CollectionNames func(db string) ([]string, error) + DatabaseNames func() ([]string, error) + FindOne func(db, collection string, skip int, query interface{}, sort []string, ...) error + Remove func(db, collection string, query interface{}) error + Run func(command interface{}, out interface{}, database string) error + RunString func(commandName string, out interface{}, database string) error + type DecodedBSONSource struct + func NewDecodedBSONSource(ds RawDocSource) *DecodedBSONSource + func (dbs *DecodedBSONSource) Err() error + func (dbs *DecodedBSONSource) Next(result interface{}) bool + type DeferredQuery struct + Coll *mongo.Collection + Filter interface{} + Hint interface{} + LogReplay bool + func (q *DeferredQuery) Count(isView bool) (int, error) + func (q *DeferredQuery) Iter() (*mongo.Cursor, error) + type NodeType string + type OpTime struct + Hash *int64 + Term *int64 + Timestamp primitive.Timestamp + func GetLatestOplogOpTime(client *mongo.Client, query interface{}) (OpTime, error) + func GetLatestVisibleOplogOpTime(client *mongo.Client) (OpTime, error) + func GetOldestActiveTransactionOpTime(client *mongo.Client) (OpTime, error) + func GetOpTimeFromOplogEntry(oplogEntry *Oplog) OpTime + func GetOpTimeFromRawOplogEntry(rawOplogEntry bson.Raw) (OpTime, error) + func (ot OpTime) String() string + type Oplog struct + Hash *int64 + LSID bson.Raw + Namespace string + Object bson.D + Operation string + PrevOpTime bson.Raw + Query bson.D + Term *int64 + Timestamp primitive.Timestamp + TxnNumber *int64 + UI *primitive.Binary + Version int + type OplogTailTime struct + Latest OpTime + Restart OpTime + func GetOplogTailTime(client *mongo.Client) (OplogTailTime, error) + type RawDocSource interface + Close func() error + Err func() error + LoadNext func() []byte + type SessionProvider struct + func NewSessionProvider(opts options.ToolOptions) (*SessionProvider, error) + func NewSessionProviderWithClient(client *mongo.Client) *SessionProvider + func (sp *SessionProvider) Close() + func (sp *SessionProvider) CreateCollection(dbName, collName string) error + func (sp *SessionProvider) DB(name string) *mongo.Database + func (sp *SessionProvider) DatabaseNames() ([]string, error) + func (sp *SessionProvider) DropDatabase(dbName string) error + func (sp *SessionProvider) FindOne(db, collection string, skip int, query interface{}, sort interface{}, ...) error + func (sp *SessionProvider) GetNodeType() (NodeType, error) + func (sp *SessionProvider) GetSession() (*mongo.Client, error) + func (sp *SessionProvider) IsMongos() (bool, error) + func (sp *SessionProvider) IsReplicaSet() (bool, error) + func (sp *SessionProvider) Run(command interface{}, out interface{}, name string) error + func (sp *SessionProvider) RunApplyOpsCreateIndex(C, DB string, index bson.D, UUID *primitive.Binary, result *interface{}) error + func (sp *SessionProvider) RunString(commandName string, out interface{}, name string) error + func (sp *SessionProvider) ServerVersion() (string, error) + func (sp *SessionProvider) ServerVersionArray() (Version, error) + type Version [3]int + func (v1 Version) Cmp(v2 Version) int + func (v1 Version) GT(v2 Version) bool + func (v1 Version) GTE(v2 Version) bool + func (v1 Version) LT(v2 Version) bool + func (v1 Version) LTE(v2 Version) bool