Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
So, I have a problem I'm working with mongoose in nodejs and I want to make a dynamic query like I have 2 fields gender and type of room and these are optionals so what I did I wrote an if condition that if gender is not undefined a variable which is q += "gender:" + " ' " + gender + " ' " + ","; and when I pass this variable in find() it doesn't work but if i write the same query directly there in find() it works what seems to be the problem?
undefined
nodejs
express
mongodb
mongoose