Database

[{"recipe":"A","timestamp":ISODate("2020-08-22T09:38:36.306Z")},{"recipe":"A","timestamp":ISODate("2020-08-21T09:38:36.306Z")},{"recipe":"B","timestamp":ISODate("2020-08-21T09:38:36.306Z")},{"recipe":"C","timestamp":ISODate("2020-08-23T09:38:36.306Z")},{"recipe":"B","timestamp":ISODate("2020-08-23T09:38:36.306Z")}]

Query

db.collection.aggregate([{$project:{createdAt:{$dateToString:{format:"%Y-%m-%d",date:"$timestamp"}},recipe:1}},{$group:{_id:"$createdAt",A:{$sum:{$cond:[{$eq:["$recipe","A"]},1,0]}},value:{$sum:1}}},{$project:{_id:0,label:"$_id",value:1,A:1,other:{"$subtract":["$value","$A"]}}}])

Result