I am trying to store Unix timestamps in nanoseconds into the Date
type field of a Mongodb database.
The unix timestamps in nanoseconds are generated in a Go program (with time.Now().UnixNano()
), submitted to Kafa to be read by a Node.js script which uses mongoose
to write the payload object containing the unix timestamp in nanoseconds to the Mongodb store.
However this is throwing an error
UnhandledPromiseRejectionWarning: ValidationError: trade validation failed: timestamp: Cast to Date failed for value "1544720051987010000" at path "timestamp"
Is there a better way to store unix timestamps in nanosecond in Mongodb?