pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
Showing only changes of commit 3017981090 - Show all commits

View File

@ -9,19 +9,19 @@ async function findPisByOrigDest(start,end) {
const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase())
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase())
const query = {
stops: {
$all: [
{ $elemMatch: { $eq: firstCrs } },
{ $elemMatch: { $eq: lastCrs } }
]
},
$expr: {
$eq: [
{ $arrayElemAt: [ "$stops", 0 ] },
firstCrs
]
}
}
stops: {
$all: [
{ $elemMatch: { $eq: firstCrs } },
{ $elemMatch: { $eq: lastCrs } }
]
},
$expr: {
$and: [
{ $eq: [{ $arrayElemAt: [ "$stops", -1 ] }, lastCrs] },
{ $eq: [{ $arrayElemAt: [ "$stops", 0 ] }, firstCrs] }
]
}
}
//const oldQuery = {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]}
const search = db.query("pis", query)
return search