Mongodb’s storage time is date type. How does js realize the function of querying historical dates?

  node.js, question

The time type stored in mongodb is date type, and you want to query the historical date in js. However, the output of Moment js or new Date () in JS is string type. How can you query the historical date? The data types are all different.

If mongoose is used, it can be directly passed into data object for query.