diff options
author | Emiliano Ciavatta | 2020-07-20 11:41:54 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-07-20 11:41:54 +0000 |
commit | 808509c6ad3515e965fdcc02520c255bec2e0c02 (patch) | |
tree | ab3c459e773df1c278b901e9a009dbb35c6ace3b | |
parent | 1317044508a9b7adf0d4d9faf4b9f75f5834a0c9 (diff) |
Add index on connection_id in connection_streams
-rw-r--r-- | storage.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -66,6 +66,13 @@ func NewMongoStorage(uri string, port int, database string) (*MongoStorage, erro return nil, err } + if _, err := collections[ConnectionStreams].Indexes().CreateOne(ctx, mongo.IndexModel{ + Keys: bson.D{{"connection_id", -1}}, // descending + Options: options.Index(), + }); err != nil { + return nil, err + } + return &MongoStorage{ client: client, collections: collections, |