When i insert with the jsontemplater a date in the mongodb writer the type of date is always string even i choose isodate, fmedate......etc. Can i have a type date in mongodb via the jsontemplater ?
Thanks a lot
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
Hi @pg.souque, according to the MognoDB Extended JSON specifications, an object with this format represents a value with date type.
{"$date": "<ISO-8601 Date/Time Format>"}
It seems that the ISO Date/Time has to be UTC date/time ending with the timezone suffix 'Z'. For instance, try inserting this JSON text into a MongoDB collection.
{ "event_name" : "FME World Tour 2020", "kick_off" : {"$date" : "2020-03-10T10:00:00Z"} }
According to the Mongodb documentation, they use something called theBSON Date data type, which is a 64-bit integer representing the number of milliseconds since the Unix epoch, which was 00:00:00 UTC on 1 January 1970.
With this information, you can calculate the correct date.