Basically, if one field exists, I want to run a query, otherwise, I want to run a separate one.
`db.Collection.aggregate([
{
$match: {
$cond: [{if fieldOnCollection:{$exists:true}}, {fieldOnCollection:'foo'}, {anotherField:'bar'}]
}
}
]);`
I've only ever seen $cond used in other stages and not to construct an actual part of the query consisting of fields on the collection itself
$$var)foowas supposed to represent just a generic boolean for the$cond. But I updated the post. The boolean itself is for if a specific field exists