Database

[{"_id":ObjectId("609a382b589346973c84c6fe"),"Name":"abc","UserId":1,"Status":"Pending","BookingData":{"Date":ISODate("2021-04-30T04:00:00.000Z"),"info":[],"BookingDataMethod":"avf","Message":null,"products":[{"_id":ObjectId("60a4e92775e5de3570578820"),"ProductName":"Test1","ProductID":ObjectId("60a4e92475e5de357057880a"),"IsDeliveryFailed":"Yes"},{"_id":ObjectId("60a4e92775e5de357057881f"),"ProductName":"Test2","ProductID":ObjectId("60a4e92475e5de357057880d"),"IsDeliveryFailed":"Yes"}],}}]

Query

db.collection.aggregate([{$match:{"BookingData.products":{"$exists":true}}},{$set:{"BookingData.products":{"$filter":{"input":"$BookingData.products","cond":{$and:[{$ne:["$$this.ProductID",undefined]},{$ne:["$$this._id",null]},{$ne:["$$this.IsDeliveryFailed","Yes"]}]}}}}},{$match:{$expr:{$ne:["$BookingData.products",[]]}}}])

Result