mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-24 17:33:22 +00:00
change 'createdat' to created_at
This commit is contained in:
parent
3ea051cb37
commit
6704ead115
@ -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))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user