Disable select: false
fields to query from specific find()
operations even try get explicitly.
#14333
Closed
2 tasks done
Labels
discussion
If you have any thoughts or comments on this issue, please share them!
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
new feature
This change adds new functionality, like a new method or class
Milestone
Prerequisites
🚀 Feature Proposal
We all know about
select:false
&sanitizeProjection
what it does. For certain query operations likefind()
,findById()
, orfindOne()
, I, as a developer, want to ensure that no sensitive data is queried. I intend to disable the inclusion of such fields explicitly, even when attempting to retrieve them using syntax likefind({}, '+password')
or through population like.populate({ path: 'users', select: '+password' })
. If I providesanitizeProjection
as an optional parameter, it should handle this exclusion for me.Here we handle the projection and population from query parameter.
Or any other suggestions?
Example:
Motivation
Motivation
The motivation stems from the ongoing development of the
mongoose-query-maker
package, where precise control over query parameters is fundamental forfiltering
,pagination
,selection
, andpopulation
in a controlled way with proper security via query parameter. Currently we're developing v3 for this, which can make it very easier from v2.Example
No response
The text was updated successfully, but these errors were encountered: