loopbackio / loopbackio/loopback-next

Filter by the concatenation of two columns

Open
#6,840 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature Repository
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

Suggestion

It would be nice to be able to filter a Model by the concatenation of two columns.
I mean, to be able to replicate this type of SQL query:

SELECT * FROM User WHERE CONCAT(name, ' ', lastName) LIKE '%PARTIAL FULLNAME%'

Use Cases

The most common example is filtering a User model by its full name when it's stored in two columns (name, lastName).
Currently, the only way this is possible (AFAIK) is by sending the RAW query, which makes it almost incompatible with adding more filters.

Examples

Table example:

id name lastName
1 Jackson Bell
2 Sarah Parker
3 Mason Brown

Example of one (possible) implementation of filter object:

{
  "limit": 10,
  "offset": 0,
  "where": {
    "leavingDate": null,
    "concat": {
      "eq": "%on B%",
      "separator": " ",
      "columns": [
        "name",
        "lastName"
      ]
    }
  }
}

Should return:

id name lastName
1 Jackson Bell
3 Mason Brown

Acceptance criteria

TBD - will be filled by the team.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed where.concat filter object and how repository filters currently handle raw queries. Clarify the acceptance criteria with the team, including supported columns, separators, comparison operators, and database behavior. Done means concatenation filtering works alongside other filters and has documented verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.