aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/storage.go b/storage.go
index b1d2a7d..aced06b 100644
--- a/storage.go
+++ b/storage.go
@@ -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,