Is there any method or function to convert int64 "637766000000000000" into date MongoDB
2
assuming that int64 is a timestamp, you could use toDate Mongo aggregation. Mongo toDate official docs
toDate
Check this
Aggregate
db.collection.aggregate([ { $set: { date: { $toDate: { $divide: [ { $subtract: [ "$date", 621355968000000000 ] }, 10000 ] } } } } ])
mongoplayground
Update
db.collection.update({}, [ { $set: { date: { $toDate: { $divide: [ { $subtract: [ "$date", 621355968000000000 ] }, 10000 ] } } } } ], { multi: true })
Click here to cancel reply.
2
Answers
assuming that int64 is a timestamp, you could use
toDate
Mongo aggregation.Mongo toDate official docs
Check this
Aggregate
mongoplayground
Update
mongoplayground