Date format in parameters doesn't work (MongoDB Query)
See original GitHub issueIssue Summary
When using date parameters in MongoDB query, we can’t use the date format, but only the number one (timestamp)
Steps to Reproduce
{
"$match": {
"_created_at": {
"$gte": {
"$date": "{{fromDate}}"
},
"$lt": {
"$date": "{{toDate}}"
}
}
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Working with datetime as string - MongoDB
Let's say some external component inserts data into my database, with a field called “startDate”. They store this value as an ISO 8601 ......
Read more >Date format in Mongo DB is wrong - Stack Overflow
In Database the date format stored is as below. Adding two same fields but values are different. ... Due to the the above...
Read more >Working with dates and times in MongoDB - Prisma
You can pass call $dateToString() with a Date object, a format string specifier, and a timezone indicator. MongoDB will use the format string...
Read more >How to Format the Date in MongoDB - Database.Guide
Example. Suppose we have a collection called cats with the following documents: · Date in dd/mm/yyyy Format. Here's another example that converts ...
Read more >Custom Date Formats - Tableau Help
To format a date field in the view, right-click (Control-click on a Mac) the field and choose Format. This will open the Format...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What works for me is using $ISODate:
Hi, is there any update on this?
I would like as well to count events during the last hour, and made the following query:
but it does not return anything, if I remove the
$match
section, it count on all the documents, and not only the last hour.