I am storing unix timestamp as MongoDB's NumberLong
type (millisecond) , how to convert to human readable date string in the Mongo shell?
NumberLong(123123123123131).toNumber().toString()
For my own future reference (and incorporating the other answers):
db.mycollection.aggregate([
{$match:{"userId":"d1792d83-d854-44d5-9jc5-e3e20435958b"}},
{$project:{newDate:Date("$numberLongDate")}}
])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With