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.
2 parents 2b2de2d + d527da5 commit 156a004Copy full SHA for 156a004
api-service/database/alerts.go
@@ -183,10 +183,16 @@ func (md *MongoDatabase) SearchAlerts(alertFilter alert_filter.Alert) (*dto.Pagi
183
bson.M{
184
"$addFields": bson.M{
185
"daysFromCreation": bson.M{
186
- "$dateDiff": bson.M{
187
- "startDate": "$date",
188
- "endDate": "$$NOW",
189
- "unit": "day",
+ "$trunc": bson.M{
+ "$divide": bson.A{
+ bson.M{
+ "$subtract": bson.A{
190
+ "$$NOW",
191
+ "$date",
192
+ },
193
194
+ 24 * 60 * 60 * 1000, // number of milliseconds in a day
195
196
},
197
198
0 commit comments