I'm wondering, is it possible to use a custom attribute in sails to query certain records? Maybe my example below will explain it better.
models/User.js
attributes: { first_name: 'string', last_name: 'string' }
models/ModelA.js
attributes: {
user: {model: 'User'},
studentName: function(){ return this.user.first_name + " " this.user.last_name },
....
}
My Query
ModelA.find({studentName: {contains: searchKeyword }}).populate('user').then(console.log);
Thanks in advance guys.