我有一个控制实体日志的mongo集合。 我想删除旧实体:
{
"_id" : ObjectId("5a3bf52aa0195f5dd63ff96e"),
"firstName" : "name17",
"email" : "email17@gamail.com",
"recovery" : {
"token" : "afcc9f4d-3fd5-4fa4-a48b-402f7eea07da",
"updatedAt" : ISODate("2017-12-21T17:53:46.710Z"),
"createdAt" : ISODate("2017-12-21T17:53:46.710Z")
},
recoveryAttempts: [{
"token" : "afcc9f4d-3fd5-4fa4-a48b-402f7eea07da",
"updatedAt" : ISODate("2017-12-21T17:53:46.710Z"),
"createdAt" : ISODate("2017-12-21T17:53:46.710Z")
}, {
"token" : "4a26e0af-d8dd-412e-83fa-fddb209ac646",
"updatedAt" : ISODate("2017-12-20T17:53:46.710Z"),
"createdAt" : ISODate("2017-12-20T17:53:46.710Z")
}, {
"token" : "34c4fd55-aea9-441d-8e0e-a5fbd0377b48",
"updatedAt" : ISODate("2017-12-19T17:53:46.710Z"),
"createdAt" : ISODate("2017-12-19T17:53:46.710Z")
}, {
"token" : "c7d67571-8a99-48e8-a7bd-e210693ff119",
"updatedAt" : ISODate("2017-12-18T17:53:46.710Z"),
"createdAt" : ISODate("2017-12-18T17:53:46.710Z")
}]
}
如何删除超过X小时的recoveryAttempts
?