[英]is there and function to convert Int64 value to date in mongodb
assuming that int64 is a timestamp, you could use toDate
Mongo aggregation.假设 int64 是时间戳,您可以使用toDate
Mongo 聚合。 Mongo toDate official docs Mongo toDate 官方文档
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
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.