From b1fb8ab57a4e9d8332f055749c87b3090b67571c Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 27 Jul 2025 14:19:38 +0100 Subject: [PATCH] Updated `MongoId` to implement `IComparable` --- Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs b/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs index 137c9e0c..ca767097 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs @@ -2,7 +2,7 @@ namespace SPTarkov.Server.Core.Models.Common; -public readonly struct MongoId : IEquatable +public readonly struct MongoId : IEquatable, IComparable { private readonly string? _stringId; @@ -110,6 +110,11 @@ public readonly struct MongoId : IEquatable return string.Equals(_stringId, other._stringId, StringComparison.OrdinalIgnoreCase); } + public int CompareTo(MongoId other) + { + return string.CompareOrdinal(_stringId, other._stringId); + } + public override bool Equals(object? obj) { return obj is MongoId other && Equals(other);