loopback
loopback copied to clipboard
Include Filter doesn't work for referencesMany relation
I am working on a ticketing system with loopback recently. I have defined a ticket model with a relation named "assignees" which reference to the model "EndUser" using referencesMany. However, when I try to list out all tickets with Include Filter, no assignees are returned from the query. Why?
Here is my model definition
{
"name": "Ticket",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"title": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"required": true
},
"status": {
"type": "string",
"default": "open"
},
"priority": {
"type": "number",
"default": 1
},
"source": {
"type": "string"
},
"tags": {
"type": [
"string"
]
},
"created": {
"type": "date",
"defaultFn": "now"
},
"modified": {
"type": "date",
"defaultFn": "now"
},
"due": {
"type": "date"
}
},
"validations": [],
"relations": {
"requester": {
"type": "belongsTo",
"model": "EndUser",
"foreignKey": "requesterId"
},
"assignees": {
"type": "referencesMany",
"model": "EndUser",
"property": "assigneeIds",
"options": {
"validate": true,
"forceId": true
}
}
},
"acls": [],
"methods": {}
}
Please post questions at https://groups.google.com/forum/#!forum/loopbackjs. See h ttps://github.com/strongloop/loopback/wiki/Questions for more details.