Again, adjust PIS query
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
43dba62434
commit
6ca8de8c75
@ -10,22 +10,20 @@ async function findPisByOrigDest(start,end) {
|
|||||||
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase())
|
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase())
|
||||||
const query = {
|
const query = {
|
||||||
stops: {
|
stops: {
|
||||||
$elemMatch: {
|
$all: [
|
||||||
$eq: firstCrs,
|
{ $elemMatch: { $eq: firstCrs } },
|
||||||
$position: 0
|
{ $elemMatch: { $eq: lastCrs } }
|
||||||
}
|
]
|
||||||
},
|
},
|
||||||
stops: {
|
$expr: {
|
||||||
$elemMatch: {
|
$eq: [
|
||||||
$eq: lastCrs,
|
{ $arrayElemAt: [ "$stops", 0 ] },
|
||||||
$position: {
|
firstCrs
|
||||||
$exists: false
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const oldQuery = {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]}
|
const oldQuery = {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]}
|
||||||
const search = db.query("pis", query)
|
const search = db.query("pis", oldQuery)
|
||||||
return search
|
return search
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user