From 7ade6fcb9c5ffc178c12f9050c2e19b5d61ebf03 Mon Sep 17 00:00:00 2001 From: Yann Stepienik Date: Tue, 14 Nov 2023 11:16:30 +0000 Subject: [PATCH] [release] v0.12.5 --- changelog.md | 3 +++ .../pages/dashboard/eventsExplorerStandalone.jsx | 2 +- package.json | 2 +- src/utils/db.go | 16 ++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 0a8afda..788efc2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## Version 0.12.5 + - Added index on event date for faster query + ## Version 0.12.4 - Fix crash with metrics not seeing any network interface diff --git a/client/src/pages/dashboard/eventsExplorerStandalone.jsx b/client/src/pages/dashboard/eventsExplorerStandalone.jsx index eaebd6b..dca6af2 100644 --- a/client/src/pages/dashboard/eventsExplorerStandalone.jsx +++ b/client/src/pages/dashboard/eventsExplorerStandalone.jsx @@ -39,7 +39,7 @@ const EventExplorerStandalone = ({initSearch, initLevel}) => { - + diff --git a/package.json b/package.json index 5e7e7e2..b6812d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cosmos-server", - "version": "0.12.4", + "version": "0.12.5", "description": "", "main": "test-server.js", "bugs": { diff --git a/src/utils/db.go b/src/utils/db.go index c288656..26c6531 100644 --- a/src/utils/db.go +++ b/src/utils/db.go @@ -217,7 +217,7 @@ func initDB() { } else { // Create a text index on the _search field model := mongo.IndexModel{ - Keys: bson.M{"_search": "text"}, // Specify the field to index here + Keys: bson.M{"_search": "text"}, } // Creating the index @@ -226,6 +226,18 @@ func initDB() { Error("Metrics - Create Index", err) return // Handle error appropriately } + + // Create a date index + model = mongo.IndexModel{ + Keys: bson.M{"Date": -1}, + } + + // Creating the index + _, err = c.Indexes().CreateOne(context.Background(), model) + if err != nil { + Error("Metrics - Create Index", err) + return // Handle error appropriately + } } c, errCo = GetCollection(GetRootAppId(), "metrics") @@ -234,7 +246,7 @@ func initDB() { } else { // create search index on metrics key model := mongo.IndexModel{ - Keys: bson.M{"Key": 1}, // Specify the field to index here + Keys: bson.M{"Key": 1}, } // Creating the index