我有使用键updated_at
并且created_at
具有字符串时间戳的对象,例如2012-08-29T16:04:34-04:00
. 我将它插入到 MongoDB 中。关键是每个对象都可以有可变数量的updated_at
and实例created_at
(它们在数组中)。是否有任何代码可用于搜索数组updated_at
并created_at
用 替换值$.created_at = new Date($.created_at)
?
{
"name":"thomas",
"created_at":"2012-08-29T16:04:34-04:00",
"updated_at":"2012-08-29T16:04:34-04:00",
"logs":[
{
"something":"something",
"created_at":"2012-08-29T16:04:34-04:00",
},
{
"something":"something",
"created_at":"2012-08-29T16:04:34-04:00",
},
]
}
到
{
"name":"thomas",
"created_at":new Date("2012-08-29T16:04:34-04:00"),
"updated_at":new Date("2012-08-29T16:04:34-04:00"),
"logs":[
{
"something":"something",
"created_at":new Date("2012-08-29T16:04:34-04:00"),
},
{
"something":"something",
"created_at":new Date("2012-08-29T16:04:34-04:00"),
},
]
}