I have a table in postgres with a column called user_ids with its type set to integer[]
However, in defining the model for the table, I cannot seem to get it right, that when I try posting to the table, it always gives me an error. I have tried this:
@property({
type: "object",
itemType: "number",
postgresql: {
dataType: "integer ARRAY"
},
name: 'user_ids'
})
userIds?: number[];
in which postgres throws the error: "message": "Unexpected number in JSON at position 109" when I post this as the body of the call:
"userIds": {
1
}
If I try this:
@property({
type: "object",
itemType: "number",
postgresql: {
dataType: "integer ARRAY"
},
name: 'user_ids'
})
userIds?: number[];
then the database throws the error: malformed array literal: "[1]" when I put this in the body
"userIds": [
1
]
Can someone tell me how to correctly define the model. I know postgres requires arrays to be in curly braces but no matter what I try, either loopback or postgres throws an error