I am trying to use the $UnionWith on my aggregation pipeline to do something like this:
ParentObject
db.getCollection("col").aggregate(
[
//Filtering the master
{$match:{'_id':ObjectId('62722c260ee18a304784d8cf')}},
//then we want to bring all data which holds the same type
{$unionWith: { coll: "col", pipeline: [{$match:{'Type':"$Type"}}]}}
])
Basically I want to return a list with the '62722c260ee18a304784d8cf' object and all other objects that holds the 'Type' property...
As far as I could see, it seems this would not be possible, or am I missing something?
Basically the "$Type" does not get resolved...
Thanks in advance!
PCBL