You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, in the findWithPagination the first line checks if the paginatedField is in the projection, otherwise it is marked for removal, similarly inside the sanitizeParams function if the fields is not in the projection it will add it to the projection.
This works when the field is an atomic field or when the field is not being queried at all but fails when the fields is an nested field that is being requested in the projection.
For example for the schema
User{location: {city: string}}
if the projection is {location: 1}
and the paginated field is location.city
than, in the first check, no location.city is not inside the projection so we should delete it at the end (which is false)
and for the sanitizeParams, no location.city is not inside the projection so we should add it.
Adding it to the projection in older versions on mongoose is fine, but in recent versions this causes a Path collision issue as we are trying to project both location and location.city