Search for JSON object using a variable using .find()
IceBotYT opened this issue · comments
IceBotYT commented
Hello!
I am making a search function for my project using ExpressJS.
The GET request will have parameters to search. A type, and the query.
For example:
http://localhost:3000/search?type=code&q=Google
and with the find function, I get an error:
pwds.find({ req.params.type: req.params.q })
^
SyntaxError: Unexpected token '.'
Is it possible to search for an object with a variable like this?
Thanks!
IceBotYT commented
Nevermind, I thought of a fix. Thanks!