I have a problem when I request the use of mongoose.I, following this Mongoose.js: Find the user by username LIKE value . But it returns empty.
This my code returns empty.
var promise = UserSchema.find({name: /req.params.keyword/ }).limit(5);
I tried to have this return empty.
var n = john; var promise = UserSchema.find({name: /n/ }).limit(5);
But I tried that it works
var promise = UserSchema.find({name: /john/ }).limit(5);
Why do I use a variable and then return empty?
source
share