I'm getting Error: Invalid argument to findOne(): 'texto pesquisado'
when running findOne
of Mongoose:
const User = mongoose.model('users', mySchema);
const query - 'texto pesquisado';
User.findOne(query, function(err, data) {
if (err) return console.log('ERROR: ', err);
return console.log('DATA: ', data);
});
I'm not finding the reason for this error because the function's arguments are apparently correct. Does anyone know what might be going on?