-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Export to Language
-
None
-
Environment:Spring boot 2.3.1, MongoDB 4.2.8 Community ,Win 10
-
Not Needed
-
Iteration Jackfruit, Iteration Lime, Iteration Maracuja, Iteration Nectarine
Mongo Pipeline
[\{$match: {[ {$match: { pd: 'PD', type: 'type1', date: { $gte: '2019-01-01', $lte: '2019-12-01' }}}, {$sort: { pd: 1, date: 1}}, {$group: { _id: { site: '$site' }, wf: { $push: { date: '$date', resources: '$resources'}} {{ } }, resources: \{ $sum: '$resources' }}}, \{$match: { resources: { $gt: 0 }} } ]
Arrays.asList( match(and(eq("pd", "PD"), eq("type", "type1"), and(gte("date", "2019-01-01"), lte("date", "2019-12-01")))), sort(orderBy(ascending("pd"), ascending("date"))), group( eq("site", "$site"), push("wf", and(eq("date", "$date"), eq("resources", "$resources"))), sum("resources", "$resources")), match(gt("resources", 0L)));
Output from Mongo Query is in the attached file view.json
Output from Java aggregates framework is
Document\{{_id=Document{{site=T}}, wf=[true, true, true, true, true, true, true, true, true, true, true, true], tresources=21.0}}}} {{2020-07-08 14:19:53.095 INFO 24544 --- [ main] com.example.services.PcfReportsService : Document\{{_id=Document{{site=G}}, wf=[true, true, true, true, true, true, true, true, true, true, true, true], tresources=458.0}}}}
The problem is that the collected items in the group are returned as True and False which is not correct and also not what is produced when using this pipeline in shell . I have no other option but to post it here as a bug . Currently I am using @aggregates to do this operation. Also It would be nice to pass the pipeline array as a single string in aggregation parameter. Currently I break the pipeline above and add it as @aggregation(pipeline={p1,p2,p3...pn}).