pis #12
@ -10,22 +10,20 @@ async function findPisByOrigDest(start,end) {
|
||||
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase())
|
||||
const query = {
|
||||
stops: {
|
||||
$elemMatch: {
|
||||
$eq: firstCrs,
|
||||
$position: 0
|
||||
}
|
||||
},
|
||||
stops: {
|
||||
$elemMatch: {
|
||||
$eq: lastCrs,
|
||||
$position: {
|
||||
$exists: false
|
||||
}
|
||||
}
|
||||
$all: [
|
||||
{ $elemMatch: { $eq: firstCrs } },
|
||||
{ $elemMatch: { $eq: lastCrs } }
|
||||
]
|
||||
},
|
||||
$expr: {
|
||||
$eq: [
|
||||
{ $arrayElemAt: [ "$stops", 0 ] },
|
||||
firstCrs
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user