-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
A query like this:
db.coll.aggregate([ {$group: { _id: "$meta.a", mostRecent: {$topN: { n: 1, sortBy: {ts: -1}, output: { ts: "$ts", measureA: "$measureA", measureB: "$measureB" } }} }} ])
or
db.coll.aggregate([ {$group: { _id: "$meta.a", mostRecent: {$top: { sortBy: {ts: -1}, output: { ts: "$ts", measureA: "$measureA", measureB: "$measureB" } }} }} ])
Will be rewritten to something like this to get the last point optimization:
db.measurements.aggregate([ {$sort: {"meta.a": 1, "ts": -1}}, {$group: { _id: "$sensorId”, ts: {$first: "$ts”}, measureA: {$first: "$measureA"}, measureB: {$first: "$measureB"} }} ])
- is depended on by
-
SERVER-61659 TS Last Point opt: final test plan review
- Closed