@tmlmobilidade/controllers 20260514.1556.50 → 20260515.1056.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/operation/lines/batch.js +19 -27
- package/dist/operation/stops/batch.js +19 -27
- package/package.json +1 -1
|
@@ -15,36 +15,32 @@ export async function getOperationalLinesBatch(query) {
|
|
|
15
15
|
start_time_scheduled: { $gte: query.date_start, $lte: query.date_end },
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
$sort: {
|
|
20
|
-
start_time_scheduled: -1, // newest first
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
18
|
{
|
|
24
19
|
$group: {
|
|
25
20
|
_id: '$hashed_trip_id',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
latest_ride: {
|
|
22
|
+
$top: {
|
|
23
|
+
output: {
|
|
24
|
+
agency_id: '$agency_id',
|
|
25
|
+
hashed_trip_id: '$hashed_trip_id',
|
|
26
|
+
operational_date: '$operational_date',
|
|
27
|
+
plan_id: '$plan_id',
|
|
28
|
+
start_time_scheduled: '$start_time_scheduled',
|
|
29
|
+
},
|
|
30
|
+
// deterministic tie-break if same timestamp appears multiple times
|
|
31
|
+
sortBy: { start_time_scheduled: -1, _id: -1 },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
32
34
|
},
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
|
-
$
|
|
36
|
-
|
|
37
|
+
$replaceRoot: {
|
|
38
|
+
newRoot: '$latest_ride',
|
|
37
39
|
},
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
|
-
$
|
|
41
|
-
|
|
42
|
-
agency_id: 1,
|
|
43
|
-
hashed_trip_id: 1,
|
|
44
|
-
line_id: 1,
|
|
45
|
-
operational_date: 1,
|
|
46
|
-
plan_id: 1,
|
|
47
|
-
start_time_scheduled: 1,
|
|
42
|
+
$sort: {
|
|
43
|
+
start_time_scheduled: -1,
|
|
48
44
|
},
|
|
49
45
|
},
|
|
50
46
|
{
|
|
@@ -61,11 +57,6 @@ export async function getOperationalLinesBatch(query) {
|
|
|
61
57
|
preserveNullAndEmptyArrays: true,
|
|
62
58
|
},
|
|
63
59
|
},
|
|
64
|
-
{
|
|
65
|
-
$sort: {
|
|
66
|
-
start_time_scheduled: -1,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
60
|
{
|
|
70
61
|
$project: {
|
|
71
62
|
_id: 0,
|
|
@@ -73,12 +64,13 @@ export async function getOperationalLinesBatch(query) {
|
|
|
73
64
|
hashed_trip_doc: 1, // full joined document
|
|
74
65
|
operational_date: 1,
|
|
75
66
|
plan_id: 1,
|
|
67
|
+
start_time_scheduled: 1,
|
|
76
68
|
},
|
|
77
69
|
},
|
|
78
70
|
];
|
|
79
71
|
const ridesCollection = await rides.getCollection();
|
|
80
72
|
const pipelineResult = await ridesCollection
|
|
81
|
-
.aggregate(pipeline)
|
|
73
|
+
.aggregate(pipeline, { allowDiskUse: true })
|
|
82
74
|
.toArray();
|
|
83
75
|
Logger.info(`OperationalLinesController.getBatch - pipeline result count: ${pipelineResult?.length ?? 0}`);
|
|
84
76
|
//
|
|
@@ -15,36 +15,32 @@ export async function getOperationalStopsBatch(query) {
|
|
|
15
15
|
start_time_scheduled: { $gte: query.date_start, $lte: query.date_end },
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
$sort: {
|
|
20
|
-
start_time_scheduled: -1, // newest first
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
18
|
{
|
|
24
19
|
$group: {
|
|
25
20
|
_id: '$hashed_trip_id',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
latest_ride: {
|
|
22
|
+
$top: {
|
|
23
|
+
output: {
|
|
24
|
+
agency_id: '$agency_id',
|
|
25
|
+
hashed_trip_id: '$hashed_trip_id',
|
|
26
|
+
operational_date: '$operational_date',
|
|
27
|
+
plan_id: '$plan_id',
|
|
28
|
+
start_time_scheduled: '$start_time_scheduled',
|
|
29
|
+
},
|
|
30
|
+
// deterministic tie-break if same timestamp appears multiple times
|
|
31
|
+
sortBy: { start_time_scheduled: -1, _id: -1 },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
32
34
|
},
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
|
-
$
|
|
36
|
-
|
|
37
|
+
$replaceRoot: {
|
|
38
|
+
newRoot: '$latest_ride',
|
|
37
39
|
},
|
|
38
40
|
},
|
|
39
41
|
{
|
|
40
|
-
$
|
|
41
|
-
|
|
42
|
-
agency_id: 1,
|
|
43
|
-
hashed_trip_id: 1,
|
|
44
|
-
line_id: 1,
|
|
45
|
-
operational_date: 1,
|
|
46
|
-
plan_id: 1,
|
|
47
|
-
start_time_scheduled: 1,
|
|
42
|
+
$sort: {
|
|
43
|
+
start_time_scheduled: -1,
|
|
48
44
|
},
|
|
49
45
|
},
|
|
50
46
|
{
|
|
@@ -61,11 +57,6 @@ export async function getOperationalStopsBatch(query) {
|
|
|
61
57
|
preserveNullAndEmptyArrays: true,
|
|
62
58
|
},
|
|
63
59
|
},
|
|
64
|
-
{
|
|
65
|
-
$sort: {
|
|
66
|
-
start_time_scheduled: -1,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
60
|
{
|
|
70
61
|
$project: {
|
|
71
62
|
_id: 0,
|
|
@@ -73,12 +64,13 @@ export async function getOperationalStopsBatch(query) {
|
|
|
73
64
|
hashed_trip_doc: 1, // full joined document
|
|
74
65
|
operational_date: 1,
|
|
75
66
|
plan_id: 1,
|
|
67
|
+
start_time_scheduled: 1,
|
|
76
68
|
},
|
|
77
69
|
},
|
|
78
70
|
];
|
|
79
71
|
const ridesCollection = await rides.getCollection();
|
|
80
72
|
const pipelineResult = await ridesCollection
|
|
81
|
-
.aggregate(pipeline)
|
|
73
|
+
.aggregate(pipeline, { allowDiskUse: true })
|
|
82
74
|
.toArray();
|
|
83
75
|
Logger.info(`OperationalStopsController.getBatch - pipeline result count: ${pipelineResult?.length ?? 0}`);
|
|
84
76
|
//
|