Closed BrstDev123 closed 7 years ago
I think, syntax is correct for multiple conditions in search.
Try console.log(preCheck)
. You will find it to be array
of matched results, not single object, that's why if
condition is failing.
Also, why are you checking it again with the received values ?
Use findOne
instead.
@BrstDev123 You are getting back an array as @staticmukesh says, whereas it appears you are expecting a hash. You could either grab the first result in the array - though that's a little brittle, or use findOne
.
var preCheck = db.users.findOne({"email" : req.body.email,"password" : req.body.password});
@BrstDev123 I'm closing this issue, guessing it's solved for you now?
Well issue was not resolved , But I have replaced diskdb with sqlite3.. If you wants then close. Thank you!
In users.json data is
[{"email":"noname@email.com","password":"123","status":"1","_id":"e39a62a9c7b94d76892f9c3bdfa22715"}]
I am using it as follows:
But it returns invalid login always.