-
-
Notifications
You must be signed in to change notification settings - Fork 570
Description
Suppose I want to filter entities in nestjs which contains a field with the following:
@IsArray()
@Column('varchar')
public languages?: String[];
which is defined by a migration as such:
{
name: 'languages',
type: 'varchar',
isArray: true,
isNullable: true,
},
Using this I'm attempting to acquire entities that contain a list of languages. However, I've run into issues when attempting to filter the entities based on this field. I'm attempting to return entities which contain any language from a list of provided languages. The filters don't seem to support this.
Ex.
filter=languages||in||{Spanish},{English},{French},{Mandarin}
This will return results whose language array ONLY contains one of those fields. Entities that contain multiple languages in this list (Example: French,Spanish) will not be returned.
A solution to this would be to send something akin to this:
filter=languages||in||{Spanish},{English}&or=languages||eq||{English,Spanish}&or=languages||eq||{Spanish,English}
But I would have to provide all possible combinations for this in order to get this to work at all. Which does not seem like a good solution at all.
Is there a way to just do something with cont, or would it be possible to implement that functionality in a different manner? Currently if you attempt something like
filter=languages||cont||{Mandarin}
this will result in the following error
{
"statusCode": 500,
"message": "operator does not exist: character varying[] ~~ unknown"
}