Here i’m checking with the collection keys
, the apikey
which im passing in postman it showing invalid credentials. the console value showing null
. Dont know where im doing wrong thanks in advance
const fKey = await Key.findOne({
password: req.params.apikey,
active: true
});
console.log("fKey....",fKey)
2
Answers
You Are Passing params instead of query in code
please look at this link for a better understanding.
The problem is not with MongoDB query. It is with request handling. You are using
req.params.apikey
instead ofreq.query.apikey
.