Search code examples
javascriptfeathers-sequelize

feathers js get custom attribute value


I'm first time using feathers and Sequelize. I want ask something for the example I have data user

name: 'user b',
email:'[email protected]',
createdAt:'2022-02-02',
updatedAt: '2022-02-02',
}

my expected return

name: 'user b',
email: '[email protected]',
}

but I got all data user b


Solution

  • You can use the after hook to delete the properties that you don't want to get. Or you can use the feathers.js common querying to deselect the specific fields and querying is the better approach.

    Still, if you want to use the hooks, here is the code example:

    after: {
        get: [ (context) => {
            delete context.result.data.fieldName;
        }
    }