Answer the question
In order to leave comments, you need to log in
How to search by time in monge?
Hello.
In monge, my data is stored like this.
And you need to search for this collection in time from and to
{
"_id" : "62066dd01f50e385be38d9d1",
"updated_at" : "2022-02-11T11:22:54.166+02:00"
}
{
"_id" : "62066dd01f50e385be38d9a0",
"updated_at" : "2022-02-14T14:14:20.654+02:00"
}
order.Updated_At = time.Now()
fromDate, _ := time.Parse("02/01/2006 15:04:05", "2022-02-14 00:00:00")
toDate, _ := time.Parse("02/01/2006 15:04:05", "2022-02-14 23:59:59")
filter := bson.M{
"updated_at": bson.M{
"$gte": fromDate,
"$lte": toDate,
},
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question