change 'createdat' to created_at

This commit is contained in:
0ceanSlim 2024-08-22 12:59:53 -04:00
parent 3ea051cb37
commit 6704ead115

View File

@ -130,17 +130,17 @@ func QueryEvents(filters []relay.Filter, client *mongo.Client, databaseName stri
} }
} }
if filter.Since != nil { if filter.Since != nil {
filterBson["createdat"] = bson.M{"$gte": *filter.Since} filterBson["created_at"] = bson.M{"$gte": *filter.Since}
} }
if filter.Until != nil { if filter.Until != nil {
if filterBson["createdat"] == nil { if filterBson["created_at"] == nil {
filterBson["createdat"] = bson.M{"$lte": *filter.Until} filterBson["created_at"] = bson.M{"$lte": *filter.Until}
} else { } else {
filterBson["createdat"].(bson.M)["$lte"] = *filter.Until filterBson["created_at"].(bson.M)["$lte"] = *filter.Until
} }
} }
opts := options.Find().SetSort(bson.D{{Key: "createdat", Value: -1}}) opts := options.Find().SetSort(bson.D{{Key: "created_at", Value: -1}})
if filter.Limit != nil { if filter.Limit != nil {
opts.SetLimit(int64(*filter.Limit)) opts.SetLimit(int64(*filter.Limit))
} }