diff --git a/eventstore/mongodb_v2/eventstore.go b/eventstore/mongodb_v2/eventstore.go index 7329ca47..b3eb4976 100644 --- a/eventstore/mongodb_v2/eventstore.go +++ b/eventstore/mongodb_v2/eventstore.go @@ -27,7 +27,6 @@ import ( "github.com/looplab/eventhorizon/mongoutils" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" mongoOptions "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" @@ -524,7 +523,7 @@ func (s *EventStore) loadFromCursor(ctx context.Context, id uuid.UUID, cursor *m } func (s *EventStore) LoadSnapshot(ctx context.Context, id uuid.UUID) (*eh.Snapshot, error) { - result := s.snapshots.FindOne(ctx, bson.M{"aggregate_id": id}, options.FindOne().SetSort(bson.M{"version": -1})) + result := s.snapshots.FindOne(ctx, bson.M{"aggregate_id": id}, mongoOptions.FindOne().SetSort(bson.M{"version": -1})) if err := result.Err(); err != nil { if errors.Is(err, mongo.ErrNoDocuments) { return nil, nil @@ -614,7 +613,7 @@ func (s *EventStore) SaveSnapshot(ctx context.Context, id uuid.UUID, snapshot eh if _, err := s.snapshots.InsertOne(ctx, record, - options.InsertOne(), + mongoOptions.InsertOne(), ); err != nil { return &eh.EventStoreError{ Err: fmt.Errorf("could not save snapshot: %w", err), diff --git a/outbox/mongodb/outbox.go b/outbox/mongodb/outbox.go index e8673dc9..c5419fb8 100644 --- a/outbox/mongodb/outbox.go +++ b/outbox/mongodb/outbox.go @@ -13,7 +13,6 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" mongoOptions "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" @@ -282,7 +281,7 @@ func (o *Outbox) runPeriodicallyUntilCancelled(f func(context.Context) error, d } func (o *Outbox) processWithWatch(ctx context.Context) error { - opts := options.ChangeStream(). + opts := mongoOptions.ChangeStream(). SetBatchSize(1) if o.resumeToken != nil { opts = opts.SetResumeAfter(o.resumeToken) diff --git a/repo/mongodb/repo.go b/repo/mongodb/repo.go index 657fc06a..0fc8deaa 100644 --- a/repo/mongodb/repo.go +++ b/repo/mongodb/repo.go @@ -21,7 +21,6 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" mongoOptions "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" @@ -357,7 +356,7 @@ func (r *Repo) Save(ctx context.Context, entity eh.Entity) error { bson.M{ "$set": entity, }, - options.Update().SetUpsert(true), + mongoOptions.Update().SetUpsert(true), ); err != nil { return &eh.RepoError{ Err: fmt.Errorf("could not save/update: %w", err),