Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live query with include won't work #1686

Open
avielfedida opened this issue May 1, 2016 · 11 comments
Open

Live query with include won't work #1686

avielfedida opened this issue May 1, 2016 · 11 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@avielfedida
Copy link

avielfedida commented May 1, 2016

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.

@chadpav
Copy link

chadpav commented May 3, 2016

My understanding is that 'include' is not supported in LiveQuery yet. You will get back to the pointer information and can perform a fetch there or implement some local caching so you don't have to call the server to resolve those related records.

@avielfedida
Copy link
Author

avielfedida commented May 3, 2016

Currently I just use the pointer id the get the user I'm looking for via another query, so I didn't understand you perfectly, should I be able to use include or its not implemented yet(with LiveQuery)?

@chadpav
Copy link

chadpav commented May 5, 2016

It's not implemented using Live Query. The way you are doing it is correct.

My last comment was just a suggestion that you keep user records in a local cache so you don't always have to immediately fetch from the server every time.

@ronaldgalangy
Copy link

Hi to all! Any update or support about include in LiveQuery?

@johncodeos
Copy link

Any news about that?

@dplewis
Copy link
Member

dplewis commented Jan 23, 2019

As @chadpav mentioned fetch the pointers or store them in local cache.

Since LDS (LocalDataStore) has been added you could use that for include.

@Jekos feel free to do a PR.

@johncodeos
Copy link

@dplewis I chose to go with @chadpav's method. Thanks.

@vdkdamian
Copy link

I clearly see that there is interest in this topic. Is there a particular reason this won't work?
Is it possible to fix this?

@mtrezza mtrezza reopened this Jan 6, 2023
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Jan 6, 2023
@DarekDev
Copy link

DarekDev commented Jul 6, 2023

This seems like a bit of random limitation that should not be there. Are there any plans to address this issue?

@mtrezza
Copy link
Member

mtrezza commented Jul 6, 2023

Does anyone want to open a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

8 participants