assuming that int64 is a timestamp, you could use toDate
Mongo aggregation. Mongo toDate official docs
Check this
Aggregate
db.collection.aggregate([
{
$set: {
date: {
$toDate: {
$divide: [
{ $subtract: [ "$date", 621355968000000000 ] },
10000
]
}
}
}
}
])
Update
db.collection.update({},
[
{
$set: {
date: {
$toDate: {
$divide: [
{ $subtract: [ "$date", 621355968000000000 ] },
10000
]
}
}
}
}
],
{
multi: true
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.