@tmlmobilidade/interfaces
Version:
This package provides SDK-style connectors for interacting with databases (e.g., stops, plans, rides, alerts) and external providers (e.g., authentication, storage). It simplifies data access and integration across projects.
17 lines (16 loc) • 572 B
JavaScript
/* * */
/**
* Builds a pipeline that enumerates all distinct `latest_apex_version`
* values present in SAM documents (ignores per-analysis versions).
*
* @param matchAnd - Optional array of $match conditions (ANDed).
* @returns Aggregation pipeline for MongoDB.
*/
export function samsApexVersionsAggregationPipeline({ matchAnd, }) {
return [
...(matchAnd.length > 0 ? [{ $match: { $and: matchAnd } }] : []),
{ $group: { _id: '$latest_apex_version' } },
{ $match: { _id: { $nin: [null, ''] } } },
{ $sort: { _id: -1 } },
];
}