Skip to content

[SUGGESTION] Adding EndsWith to Query and QueryAny #2726

@rube200

Description

@rube200

Is your feature request related to a problem? Please describe.
Yes, currently, the Query class has the Contains and StartsWith methods, but it lacks an EndsWith method. This limits the ability to efficiently query strings that should end with a specific value.

Describe the solution you'd like
I would like to see an EndsWith method added to the Query class, similar to the existing Contains and StartsWith methods. This would allow for more flexible string querying, particularly when checking for specific suffixes in a string.

Describe alternatives you've considered

  • Using an expression directly: Find(x => x.Content.EndsWith("value"))
  • Using a raw query string: $"$.Content LIKE {new BsonValue("%" + value)}"
    While these alternatives are functional, they require more verbose and less intuitive code compared to having a built-in EndsWith method in the Query class.

Additional context
The addition of the EndsWith method would make string querying more complete and provide better support for common patterns where the end of the string matters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions