parse-community / parse-community/parse-server
Live query with include won't work
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
I have a table, one of the table fields points to the users table, here is my code:
var subscription = (new Parse.Query('Queue')).include('requestingUser').subscribe();
subscription.on('create', function(queueObject) {
queueObject.get('requestingUser') // user object
queueObject.get('requestingUser').get('name') // undefined
})
Within the parse server index.js I set:
liveQuery: {
classNames: ["_User", "User", "Queue"] // Just in case I did try "_User" and "User"
}
I also tried another table, other than users table, doesn't work either.
This is the response(if it helps):
HTTP/1.1 201 Created
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, Content-Type
Location: http://localhost:1337/parse/classes/Queue/cFwSWuzUXx
Content-Type: application/json; charset=utf-8
Content-Length: 64
Date: Sun, 01 May 2016 22:04:16 GMT
Connection: keep-alive
Honestly, I'm not sure if it's a bug but I was trying to find out if it's even possibly to use include with live query and didn't find anything like that in the docs, but the docs suggest that subscribe is just instead of find for example so I don't think include should be a problem and it is.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the liveQuery configuration in index.js and reproduce the Queue subscription using the requestingUser include shown in the issue. Trace how Parse.Query(...).include(...).subscribe() handles related objects and compare the result with the reported response. Done means establishing whether includes are supported for live queries and resolving or clearly documenting the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100