Skip to content

Commit a6ec287

Browse files
authored
Merge pull request #16 from hellofresh/patch/mongo-driver-1.0
Bumped mongo driver to 1.0-rc1 to use new package structure
2 parents 7ccfaf2 + 9e8734d commit a6ec287

File tree

4 files changed

+58
-57
lines changed

4 files changed

+58
-57
lines changed

Gopkg.lock

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
name = "github.com/gofrs/uuid"
4242
version = "3.2.0"
4343

44-
[[constraint]]
45-
name = "github.com/mongodb/mongo-go-driver"
46-
version = "0.3.0"
47-
4844
[prune]
4945
go-tests = true
5046
unused-packages = true
47+
48+
[[constraint]]
49+
name = "go.mongodb.org/mongo-driver"
50+
version = "v1.0.0-rc1"

cmd/goengine/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/hellofresh/goengine"
1010
"github.com/hellofresh/goengine/mongodb"
1111
"github.com/hellofresh/goengine/rabbit"
12-
"github.com/mongodb/mongo-go-driver/mongo"
13-
"github.com/mongodb/mongo-go-driver/mongo/options"
12+
"go.mongodb.org/mongo-driver/mongo"
13+
"go.mongodb.org/mongo-driver/mongo/options"
1414
)
1515

1616
func main() {
@@ -26,9 +26,10 @@ func main() {
2626
}
2727

2828
goengine.Log("Connecting to the database", map[string]interface{}{"dsn": mongoDSN}, nil)
29-
mongoClient, err := mongo.NewClientWithOptions(
30-
mongoDSN,
31-
options.Client().SetAppName("goengine"),
29+
mongoClient, err := mongo.NewClient(
30+
options.Client().
31+
ApplyURI(mongoDSN).
32+
SetAppName("goengine"),
3233
)
3334
if err != nil {
3435
goengine.Log("Failed to create new Mongo mongoClient", nil, err)

mongodb/eventstore.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66

77
"github.com/hellofresh/goengine"
88
"github.com/hellofresh/goengine/reflection"
9-
"github.com/mongodb/mongo-go-driver/bson"
10-
"github.com/mongodb/mongo-go-driver/mongo"
11-
"github.com/mongodb/mongo-go-driver/mongo/options"
12-
"github.com/mongodb/mongo-go-driver/x/bsonx"
9+
"go.mongodb.org/mongo-driver/bson"
10+
"go.mongodb.org/mongo-driver/mongo"
11+
"go.mongodb.org/mongo-driver/mongo/options"
12+
"go.mongodb.org/mongo-driver/x/bsonx"
1313
)
1414

1515
// MongoEvent represents an event on mongodb
@@ -163,7 +163,7 @@ func (s *EventStore) CountEventsFor(streamName goengine.StreamName, id string) (
163163
ctx, cancel := s.cs.CountEventsFor()
164164
defer cancel()
165165

166-
return s.mongoDB.Collection(string(streamName)).Count(ctx, bson.M{"aggregate_id": string(streamName)})
166+
return s.mongoDB.Collection(string(streamName)).CountDocuments(ctx, bson.M{"aggregate_id": string(streamName)})
167167
}
168168

169169
func (s *EventStore) createIndices(c *mongo.Collection) error {

0 commit comments

Comments
 (0)