Feature Idea: Ability to omit a column from queries by default #17069
Unanswered
jhuntdev
asked this question in
Help & Questions
Replies: 1 comment
-
This would be a nice feature. It would even make it easier to reduce the data being fetched by default We do have a preference for default-false options (some options are currently default true but we can only do so many breaking changes in one major release). This option would impact more than |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Mongoose (ORM for MongoDB) has an option on their schemas to prevent a column from being queried unless specifically requested. The most obvious benefit of this feature is that some columns on a table are sensitive (e.g. password), and this protects you if a developer accidentally does a star (*) select on that table and it gets overlooked and deployed.
How this might work in Sequelize:
Note: If a default-false option is preferred, something like "private: true", "hidden: true", or "exclude: true" could also work.
I've looked for an equivalent option in Sequelize, but haven't found one. I also looked at the source code, but it looks like it might be a little tricky to implement this for someone not well acquainted with the codebase.
Beta Was this translation helpful? Give feedback.
All reactions