I need to store time in my collection, this application is something related to the creating Doctor Appointment.
Doctor will create an slot which he’ll be available within, user will be creating an appointment between that time. I tried storing the time like (10:30, unix type) but I couldn’t do aggregation properly. they’re filtering wrongly. what would be the best way to store the time in the Mongo db collection and I also need to do some filter things with that.
Please provide sample documents. This way we will understand better
and
Provide the queries and aggregations you have tried and explain what
This way we can save time by not investigating and proposing something you know does not fit your requirements.
And on the subject of the
My recommendation is to use the native Date type since it comes with a rich API.
I tried using unix timestamp to store the data.
I could see that it works good but the filtering is what I’m actually sturggling with
here I’ve attached a sample one,
{
“a”: 10,
“b”: 20
},
{
“a”: 30,
“b”: 40
}
now lets say I’m giving and input value between 10-20 example [11] then this should be the document filtered
{
“a”: 10,
“b”: 20
},
now lets say I’m giving and input value between 30-40 example [33] then this should be the document filtered
{
“a”: 30,
“b”: 40
}
Please provide sample documents in JSON so that we can import them in our environment.
Please share the aggregations and queries in MQL form that you tried.
You write
but the following are simple integer.
We need real data, with real numbers.