I have a query that should return multiple subdocuments from an array in a document, based on a timestamp range criteria. I first choose the main documents by specifying some id's:
In the Mongo Shell it is:
db.fps.find({"_id": {$in: [15,24] }}, {someArray: {$elemMatch: {Timestamp: {$gt: "2018-06-06T18:00:00", $lt:"2018-06-07"}}}}).pretty()
Because of $elemMatch, it returns only the first document that matches my query. However, I want all relevant documents returned that match the criteria.
How would I have to do the query in mongoose?