diff --git a/pom.xml b/pom.xml
index d63c0ed..1079375 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,6 +83,12 @@
jedis
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+
+
org.projectlombok
diff --git a/src/main/java/xyz/mcutils/backend/repository/MetricsRepository.java b/src/main/java/xyz/mcutils/backend/repository/MetricsRepository.java
index 7f51ae7..1335f3b 100644
--- a/src/main/java/xyz/mcutils/backend/repository/MetricsRepository.java
+++ b/src/main/java/xyz/mcutils/backend/repository/MetricsRepository.java
@@ -1,6 +1,6 @@
package xyz.mcutils.backend.repository;
-import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.mongodb.repository.MongoRepository;
import xyz.mcutils.backend.service.metric.Metric;
/**
@@ -8,4 +8,4 @@ import xyz.mcutils.backend.service.metric.Metric;
*
* @author Braydon
*/
-public interface MetricsRepository extends CrudRepository, String> { }
\ No newline at end of file
+public interface MetricsRepository extends MongoRepository, String> { }
\ No newline at end of file
diff --git a/src/main/java/xyz/mcutils/backend/service/MetricService.java b/src/main/java/xyz/mcutils/backend/service/MetricService.java
index 87bfd25..b247436 100644
--- a/src/main/java/xyz/mcutils/backend/service/MetricService.java
+++ b/src/main/java/xyz/mcutils/backend/service/MetricService.java
@@ -101,7 +101,7 @@ public class MetricService {
for (Metric> metric : metrics.values()) {
saveMetric(metric);
}
- log.info("Saved {} metrics to Redis", metrics.size());
+ log.info("Saved {} metrics to MongoDB", metrics.size());
}
/**
diff --git a/src/main/java/xyz/mcutils/backend/service/metric/Metric.java b/src/main/java/xyz/mcutils/backend/service/metric/Metric.java
index 41b7c06..1b92943 100644
--- a/src/main/java/xyz/mcutils/backend/service/metric/Metric.java
+++ b/src/main/java/xyz/mcutils/backend/service/metric/Metric.java
@@ -7,12 +7,12 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
-import org.springframework.data.redis.core.RedisHash;
+import org.springframework.data.mongodb.core.mapping.Document;
import xyz.mcutils.backend.service.MetricService;
@AllArgsConstructor
@Getter @Setter @ToString
-@RedisHash(value = "metric")
+@Document("metrics")
public abstract class Metric {
/**
* The id of the metric.
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 09a8b87..be960a4 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -17,6 +17,10 @@ spring:
database: 1
auth: "" # Leave blank for no auth
+ mongodb:
+ uri: mongodb://localhost:27017
+ database: database
+
# Disable default metrics
management:
endpoints: