Skip to content
Advertisement

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:'userb@mail.com',
createdAt:'2022-02-02',
updatedAt: '2022-02-02',
}

my expected return

name: 'user b',
email: 'userb@mail.com',
}

but I got all data user b

Advertisement

Answer

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;
    }
}
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement