Skip to content

Commit

Permalink
Merge pull request #15 from hellofresh/hotfix/version-ordering
Browse files Browse the repository at this point in the history
Fixed aggregate versions ordering
  • Loading branch information
vgarvardt authored Feb 25, 2019
2 parents 78c03a3 + b912bac commit 7ccfaf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aggregate_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ func (r *PublisherRepository) Reconstitute(id string, source AggregateRoot, stre
}

source.SetVersion(events[len(events)-1].Version)
Log("Aggregate reconstituted", map[string]interface{}{"id": id}, nil)
Log("Aggregate reconstituted", map[string]interface{}{"id": id, "stream": streamName}, nil)
return nil
}
2 changes: 1 addition & 1 deletion mongodb/eventstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *EventStore) createIndices(c *mongo.Collection) error {
mongo.IndexModel{
Keys: bsonx.Doc{
{Key: "aggregate_id", Value: bsonx.Int32(1)},
{Key: "version", Value: bsonx.Int32(-1)},
{Key: "version", Value: bsonx.Int32(1)},
},
Options: options.Index().SetUnique(true).SetBackground(true),
},
Expand Down

0 comments on commit 7ccfaf2

Please sign in to comment.