How to range query a date field within an array of nested documents?

Hello @Stefan_Tesoi, welcome to the MongoDB Community Forum!

Your query looks just about correct as per this documentation example: Query an Array of Embedded Documents - A Single Nested Document Meets Multiple Query Conditions on Nested Fields.

You can use projection : Project Specific Array Elements in the Returned Array. The documentation also says:

See the aggregation operator $filter to return an array with only those elements that match the specified condition.

Here are posts with similar question and use $filter:

3 Likes