I am using MongoTemplate to accomplish my task with 2 queries. But wanted to know if it's possible to do the same with a single query. Example-
- Filter the records based on a boolean value (isSaved),
- In each record pick the field(boughtDate) and check if it was bought yesterday.
- If yes, then update the field(isPromoValid) to true.
What I do now is. I just query to get the records based on a filter condition. Locally do date comparison on each record's Date field. Then use updateMany to update all the records