Skip to content

todo(cas): remove unindexed regex search for existing users #39744

@himanshu2006

Description

@himanshu2006

This PR resolves a lingering TODO in the CAS login flow by replacing an unindexed regex query with a direct, indexed lookup.

Previously, the fallback username check used new RegExp('^' + username + '$', 'i'). Because this utilized the case-insensitive i flag without a supporting collation index, it forced MongoDB to perform a collection scan. By replacing this with a direct { username } query, we ensure the database utilizes the standard index, preventing potential CPU spikes during CAS authentication on large instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions