Working with Dates
Use Date objects for time queries.
Example
db.events.insertOne({ at: new Date("2026-03-15") })
db.events.find({ at: { $gte: new Date("2026-01-01") } })Exercise
New date.
new ("2026-03-15")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.