From 872116c29804149e8cbfdf482b6b1ea342179c24 Mon Sep 17 00:00:00 2001 From: Charly Fau Date: Thu, 14 Dec 2023 10:05:21 -0300 Subject: [PATCH] Revert incorrect change --- eventstore/mongodb_v2/eventstore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventstore/mongodb_v2/eventstore.go b/eventstore/mongodb_v2/eventstore.go index 64bc1dd5..6a13cff3 100644 --- a/eventstore/mongodb_v2/eventstore.go +++ b/eventstore/mongodb_v2/eventstore.go @@ -536,7 +536,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}) + result := s.snapshots.FindOne(ctx, bson.M{"aggregate_id": id}, options.FindOne().SetSort(bson.M{"version": -1})) if err := result.Err(); err != nil { if errors.Is(err, mongo.ErrNoDocuments) { return nil, nil