Closed
Description
I have created a model that has an array field of categories. Here is the property definition:-
@property({
type: 'string',
postgresql: { columnName: 'categories', dataType: 'ARRAY', dataLength: null, dataPrecision: null, dataScale: null, nullable: 'YES' },
})
categories?: string;
And when I apply filters like this:
const filter1: any = {
where: {
categories: { contains: ['ViewLibrarySong'] },
},
};
return this.blogRepository.find(filter1);
I am getting value of the column as string here. i.e. operatorValue's value is '["ViewLibrarySong"]'.
case 'contains':
return new ParameterizedSQL(columnName + ' @> array[' + operatorValue.map((v) => `'${v}'`) + ']::'
+ propertyDefinition.postgresql.dataType);
The application is getting crashed as map will not work on string.