Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{"key":1},{"key":2}]
Query
db.collection.aggregate([{$set:{clientsAllowed:{$cond:{if:{$and:[{"$eq":[{$type:"$bussinessAllowed"},"array"]},{$ne:["$bussinessAllowed",[]]}]},then:[],else:[]}}}}])
Result