Database

[{date:[{"updatedAt":"2020-10-01T12:12:12Z"},{"updatedAt":"2020-10-01T12:12:12Z"},{"updatedAt":"2020-10-01T12:12:12Z"},{"updatedAt":null},{"updatedAt":"2020-10-01T12:12:12Z"}]}]

Query

db.collection.aggregate([{$project:{size:{$reduce:{input:{$slice:["$date",1,{$subtract:[{$size:"$date"},2]}]},initialValue:0,in:{$add:["$$value",{$cond:[{$ne:["$$this.updatedAt",null]},1,0]}]}}}}}])

Result