I'm developing a web service using MEAN stack + Mongoose, and one of the things I need to implement is storing a date as an object's field. But the thing is, the time should be optional, e.g. the user should be able to save an object filling in only the date without time.
How can I achieve this result? And how can I search on this field later?