pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
1 changed files with 5 additions and 1 deletions
Showing only changes of commit 5da7a951e3 - Show all commits

View File

@ -7,7 +7,11 @@ async function findPisByOrigDest(start,end) {
log.out(`pisServices.findPisByOrigDest: Searching for PIS for Orig: ${start}, Dest: ${end}`, "dbug")
/* Here, I need to query the collection for a document with a stops array starting with $start
and ending with $end. This will return an array of one or more pis codes and stopping patterns*/
const search = db.query("pis", {query:query})
// Query to find first stop: {$expr:{$eq:[{$first:"$stops"},start]}}
// Query to find end stop: {$expr:{$eq:[{$last:"$stops"},end]}}
// Attempt at combining the queries:
// {$and:[{$expr:{$eq:[{$first:"$stops"},start]}},{$expr:{$eq:[{$last:"$stops"},end]}}]}
const search = db.query("pis", {$and:[{$expr:{$eq:[{$first:"$stops"},start]}},{$expr:{$eq:[{$last:"$stops"},end]}}]})
return search
}