I have the following query:
cursor=self.postCol.aggregate([ { \"$graphLookup\" : { \"from\": \"pCol\", \"startWith\": \"$parent\",
You can replace the else condition with below using $let operator.
$let
{ $let: { vars: { obj: { "$arrayElemAt": ["$parents", 0] } }, in: "$$obj.pValue" } }