In an expression ($expr), and only in an expression, I want to check the presence of a field with a navigation path.
db.haystack.aggregate(
[
{
'$match': {
'$expr':
{ 'a.b.c': { '$ne': null } },
},
},
],
);
But I receive an error FieldPath field names may not contain '.'
How can can check the presence of field in an $expr ? If some part of paths is not present, I want to reject the document.
{ a: 1 } // False
{ a: { b: 1 } } // False
{ a: { b: { c: 1 } } // True