I am learning node.js with mongo db. I have a code to fetch records and that works fine
await studentModel.find({}, (err, data) => {
if (err) throw err;
students= data.map((d) => {
return new InterviewQuestion(d['roll_no'], d['name']);
});
});
but when I want to filter them then the query doesn't return any record
await studentModel.find({sClass: sClass}, (err, data) => { //sClassis a field in document and also the name of variable
if (err) throw err;
students= data.map((d) => {
return new InterviewQuestion(d['roll_no'], d['name']);
});
});