'Adding current Date as new Date() in a string key in mongo db

I am trying yo add the below json to my mongo DB collection, The document has a field named value which is String.

"value" : "{\"name\"\"sample\":{\"maximumDate\":newDate(),\"is24hoursFormat\":true}}"

It is inserted correctly but when I run it, I don't get the date instead I get back new Date() as Text. I want to have current date inserted into it. Date should be always current, it is not static.

Can someone help me in this



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source