需求是查询超过submit2DeptTime 2个小时 还未操作的文档时间
db.getCollection('cbdocument').aggregate([
{
$project:
{
_id:'$_id',
doctitle:'$doctitle',
cbAuthor:'$cbAuthor',
docstatus:'$docstatus',
submit2DeptTime: {
$ifNull:['$submit2DeptTime',new Date()]
},
submit2DeptModifyTime: {
$ifNull:['$submit2DeptModifyTime',new Date()]
},
// ... 其他需要查询的字段
}
}
,
{
$project:
{
_id:'$_id',
doctitle:'$doctitle',
cbAuthor:'$cbAuthor',
docstatus:'$docstatus',
submit2DeptTime:'$submit2DeptTime',
submit2DeptModifyTime:'submit2DeptModifyTime',