mirror of
https://github.com/arnaucube/commonroutesServer.git
synced 2026-02-28 05:26:42 +01:00
search travels by from.name and to.name
This commit is contained in:
@@ -29,8 +29,8 @@ exports.searchByString = function (req, res) {
|
||||
if (err) return res.send(500, err.message);
|
||||
travelModel.find({
|
||||
$or:[
|
||||
{from: new RegExp(req.params.searchstring, "i")},
|
||||
{to: new RegExp(req.params.searchstring, "i")},
|
||||
{'from.name': new RegExp(req.params.searchstring, "i")},
|
||||
{'to.name': new RegExp(req.params.searchstring, "i")},
|
||||
{title: new RegExp(req.params.searchstring, "i")}
|
||||
]
|
||||
})//perquè retorni tots els objectes que continguin l'string sense necessitat de que sigui exactament la mateixa string
|
||||
|
||||
Reference in New Issue
Block a user