Filter based on a Sub-Sub-Array

Thanks again @MaxOfLondon - you have pinpointed the problem… wrong data types!

When doing the initial data modelling, holes was intended to be an Array of Objects. Somehow with other coding (translating this through PHP currently), these documents were being saved as Object of Objects, which meant the standard querying methods weren’t working.

Using the Atlas UI, I can filter the matching documents with the simple / standard syntax:

{ "holes.holeGross": { $lte: 2  } }

Which doesn’t require any aggregation.

1 Like