We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cc00c7 commit b167504Copy full SHA for b167504
LiteDB/Document/BsonValue.cs
@@ -500,6 +500,17 @@ public static implicit operator BsonValue(DateTime value)
500
return left.AsDouble / right.AsDouble;
501
}
502
503
+ // %
504
+ public static BsonValue operator %(BsonValue left, BsonValue right)
505
+ {
506
+ if (!left.IsNumber || !right.IsNumber) return BsonValue.Null;
507
+ if (left.IsInt32 && right.IsInt32) return left.AsInt32 % right.AsInt32;
508
+ if (left.IsInt64 && right.IsInt64) return left.AsInt64 % right.AsInt64;
509
+ if (left.IsDecimal && right.IsDecimal) return left.AsDecimal % right.AsDecimal;
510
+
511
+ return left.AsDouble % right.AsDouble;
512
+ }
513
514
public override string ToString()
515
{
516
return JsonSerializer.Serialize(this);
0 commit comments