Skip to content

Commit 7ccfaf2

Browse files
authored
Merge pull request #15 from hellofresh/hotfix/version-ordering
Fixed aggregate versions ordering
2 parents 78c03a3 + b912bac commit 7ccfaf2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

aggregate_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ func (r *PublisherRepository) Reconstitute(id string, source AggregateRoot, stre
7373
}
7474

7575
source.SetVersion(events[len(events)-1].Version)
76-
Log("Aggregate reconstituted", map[string]interface{}{"id": id}, nil)
76+
Log("Aggregate reconstituted", map[string]interface{}{"id": id, "stream": streamName}, nil)
7777
return nil
7878
}

mongodb/eventstore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (s *EventStore) createIndices(c *mongo.Collection) error {
175175
mongo.IndexModel{
176176
Keys: bsonx.Doc{
177177
{Key: "aggregate_id", Value: bsonx.Int32(1)},
178-
{Key: "version", Value: bsonx.Int32(-1)},
178+
{Key: "version", Value: bsonx.Int32(1)},
179179
},
180180
Options: options.Index().SetUnique(true).SetBackground(true),
181181
},

0 commit comments

Comments
 (0)