[SOLVED] Can't find an occurence with router param


#1

Hello everyone,

I come back to you for a new problem :disappointed:.

I want to find an occurrence in my database with the url parameter.

When I do this:

   let param = 327;
   return Depart.find({"numero_arret" : param});

It works, but when I do that:

        let paramUrl = Router.current().params.arret;
        return Depart.find({"numero_arret" : paramUrl });

It doesn’t work, I can’t understand why, what should I do (all from my template) ?
Thanks for your help!


#2

This is probably because param is a number, but paramUrl is a string. MongoDB does strict type checking. Try converting paramUrl to a number before querying the database.


#3

Thank you so much, I’m ashamed I didn’t think of that. :pensive: