Suppose I had this data structure as my document:
{
id: 1,
customers: [
{
id: 2,
addresses: [
{
phone: "555-342",
zipCode: "1946873193",
addressLine: "whatever"
}
]
}
]
}
How do I access the phone property in the aggregation framework?
$ROOT.customers.0.addresses.0.phone doesn't work as a field path expression.
{ $arrayElemAt: [ "$customers", 0 ] }, notcustomers.0. Applies to all arrays.