Versions in this module Expand all Collapse all v1 v1.4.5 Dec 28, 2022 v1.4.4 Dec 28, 2022 Changes in this version + var ErrNotFound = mongo.ErrNoDocuments + func FormatAddr(hosts []string) string + func Inject(key string, client *mongo.Client) + func SetSlowThreshold(threshold time.Duration) + type BulkInserter struct + func NewBulkInserter(coll *mongo.Collection, interval ...time.Duration) *BulkInserter + func (bi *BulkInserter) Flush() + func (bi *BulkInserter) Insert(doc interface{}) + func (bi *BulkInserter) SetResultHandler(handler ResultHandler) + type ClosableClient struct + func (cs *ClosableClient) Close() error + type Collection interface + Aggregate func(ctx context.Context, pipeline interface{}, opts ...*mopt.AggregateOptions) (*mongo.Cursor, error) + BulkWrite func(ctx context.Context, models []mongo.WriteModel, opts ...*mopt.BulkWriteOptions) (*mongo.BulkWriteResult, error) + Clone func(opts ...*mopt.CollectionOptions) (*mongo.Collection, error) + CountDocuments func(ctx context.Context, filter interface{}, opts ...*mopt.CountOptions) (int64, error) + Database func() *mongo.Database + DeleteMany func(ctx context.Context, filter interface{}, opts ...*mopt.DeleteOptions) (*mongo.DeleteResult, error) + DeleteOne func(ctx context.Context, filter interface{}, opts ...*mopt.DeleteOptions) (*mongo.DeleteResult, error) + Distinct func(ctx context.Context, fieldName string, filter interface{}, ...) ([]interface{}, error) + Drop func(ctx context.Context) error + EstimatedDocumentCount func(ctx context.Context, opts ...*mopt.EstimatedDocumentCountOptions) (int64, error) + Find func(ctx context.Context, filter interface{}, opts ...*mopt.FindOptions) (*mongo.Cursor, error) + FindOne func(ctx context.Context, filter interface{}, opts ...*mopt.FindOneOptions) (*mongo.SingleResult, error) + FindOneAndDelete func(ctx context.Context, filter interface{}, opts ...*mopt.FindOneAndDeleteOptions) (*mongo.SingleResult, error) + FindOneAndReplace func(ctx context.Context, filter, replacement interface{}, ...) (*mongo.SingleResult, error) + FindOneAndUpdate func(ctx context.Context, filter, update interface{}, ...) (*mongo.SingleResult, error) + Indexes func() mongo.IndexView + InsertMany func(ctx context.Context, documents []interface{}, opts ...*mopt.InsertManyOptions) (*mongo.InsertManyResult, error) + InsertOne func(ctx context.Context, document interface{}, opts ...*mopt.InsertOneOptions) (*mongo.InsertOneResult, error) + ReplaceOne func(ctx context.Context, filter, replacement interface{}, ...) (*mongo.UpdateResult, error) + UpdateByID func(ctx context.Context, id, update interface{}, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) + UpdateMany func(ctx context.Context, filter, update interface{}, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) + UpdateOne func(ctx context.Context, filter, update interface{}, opts ...*mopt.UpdateOptions) (*mongo.UpdateResult, error) + Watch func(ctx context.Context, pipeline interface{}, opts ...*mopt.ChangeStreamOptions) (*mongo.ChangeStream, error) + type Model struct + func MustNewModel(uri, db, collection string, opts ...Option) *Model + func NewModel(uri, db, collection string, opts ...Option) (*Model, error) + func (m *Model) Aggregate(ctx context.Context, v, pipeline interface{}, opts ...*mopt.AggregateOptions) error + func (m *Model) DeleteMany(ctx context.Context, filter interface{}, opts ...*mopt.DeleteOptions) (int64, error) + func (m *Model) DeleteOne(ctx context.Context, filter interface{}, opts ...*mopt.DeleteOptions) (int64, error) + func (m *Model) Find(ctx context.Context, v, filter interface{}, opts ...*mopt.FindOptions) error + func (m *Model) FindOne(ctx context.Context, v, filter interface{}, opts ...*mopt.FindOneOptions) error + func (m *Model) FindOneAndDelete(ctx context.Context, v, filter interface{}, ...) error + func (m *Model) FindOneAndReplace(ctx context.Context, v, filter, replacement interface{}, ...) error + func (m *Model) FindOneAndUpdate(ctx context.Context, v, filter, update interface{}, ...) error + func (m *Model) StartSession(opts ...*mopt.SessionOptions) (sess mongo.Session, err error) + type Option func(opts *options) + type ResultHandler func(*mongo.InsertManyResult, error)