Reputation: 994
I have two collections called 'store' and 'items' , where store keep all product records belongs to the supermarket with timestamp. And 'items' keeps records of some details about purchases.
Store Collection
{{"id": "802736816700002577966429","$date": "2021-05-05T07:02:51Z","state":"VALID"},{"id": "802736816700002577966430","$date": "2021-07-27T07:02:51Z","state":"NOT VALID"},{"id": "802736816700002577966430","$date": "2021-04-27T07:02:51Z","state":"VALID"}}
Item Collection
{{"id": "802736816700002577966429","$date": "2021-05-05T07:02:51Z"},{"id": "802736816700002577966430","$date": "2021-07-27T07:02:51Z"},{"id": "802736816700002577966430","$date": "2021-07-27T07:02:51Z"}}
The query which i want to execute is ->
Select items from Store Collection where state != VALID and timestamp<2021-05-10 and then delete corresponding items from Item Collection
Please provide Spring-boot criteria/aggregation code which is similar to
Criteria criteriaEvt = new Criteria(....);
Aggregation aggregationEvt = newAggregation(.....)
Upvotes: 0
Views: 95