Closed hajjD closed 2 years ago
LiveQuery doesn't support every type of query. You can see one of the newer PR's on the server that added more constraints, https://github.com/parse-community/parse-server/pull/7113 and check here for all current, https://github.com/parse-community/parse-server/blob/alpha/spec/QueryTools.spec.js. If you find something missing that you think should be added on the server, I suggest opening an issue there with a possible PR to fix. You may also want open an issue for the live query server to throw an error if a query isn’t supported. More info can be found in the LiveQuery Spec, https://github.com/parse-community/parse-server/wiki/Parse-LiveQuery-Protocol-Specification#subscribe-message
From your log:
Successfully subscribed to new query Message ({"limit":100,"skip":0,"_method":"GET","where":{"parties":{"$in":["CwyLdNXNAH"]}}}) Saved Message
The Swift SDK passes containedIn
to the server correctly, meaning once the server supports this type of query it will automatically trigger events (the Swift SDK already supports this query, but the server doesn’t).
If you find containedIn
not working for a regular query, your issue should then be in this repo.
Pardon additional question... Is this issue about updating the query after it is subscribed for the first time? Because I am actually using "containedIn" as per command above and it is working. I just have to unsubscribe it and subscribe again whenever I need to change the array of the criteria
Pardon additional question... Is this issue about updating the query after it is subscribed for the first time? Because I am actually using "containedIn" as per command above and it is working. I just have to unsubscribe it and subscribe again whenever I need to change the array of the criteria
No unfortunately despite the subscription I would get zero updates/deletions etc. What version of parse server are you on?
@EliteTechnicalCare you should provide more information in your question. For example, show all of your complete ParseObject
's in question.
I suspect the parties
field is actually of type "pointer", if so, your query isn't correct.
Also, you should check if your regular containedIn
query works before trying it with LiveQuery. The examples you showed are completely different from each other and aren't checking the same property:
query = query.where(containedIn(key: "parties", array: [usersProfile.id])) query = query.where("senderID" == "VcF9fMCyKb")
For questions, you should ask here: https://community.parseplatform.org
as oppose to opening issues.
@EliteTechnicalCare you should provide more information in your question. For example, show all of your complete
ParseObject
's in question.I suspect the
parties
field is actually of type "pointer", if so, your query isn't correct.
parties is an Array not a pointer.
Also, you should check if your regular
containedIn
query works before trying it with LiveQuery. The examples you showed are completely different from each other and aren't checking the same property:query = query.where(containedIn(key: "parties", array: [usersProfile.id])) query = query.where("senderID" == "VcF9fMCyKb")
As I specified in my original post, the query works perfectly fine, it simply doesn't auto update after the initial fetch.
For questions, you should ask here: https://community.parseplatform.org
as oppose to opening issues.
What question have I asked this entire thread?
Your original post and everything after doesn’t signal there’s an actual issue. You haven’t provided enough information to elude to an issue or even replicate an issue. It seems, from your post, you are probably not setting up your queries correctly which is why this is labeled as a question. If your ask the question, “how to properly setup a live query using containedIn?” on the link I provided and provide the details of your ParseObjects and queries, you will most likely get what you need. If there happens to be a bug with correct setup, then you should open an issue.
As I specified in my original post, the query works perfectly fine, it simply doesn't auto update after the initial fetch.
Your original post looks sketchy and doesn't provide enough info as I mentioned here. Your post is better suited as a question until we can see you are querying correctly and there's in fact a real bug.
you are probably not setting up your queries correctly
Which is why it works perfectly fine until I attempt a LiveQuery with it. I haven't asked a question, I understand how queries work. They are working perfectly fine, the only issue is when I use a query with containedIn with LiveQuery. Every other query ive tested works fine with LiveQuery. So I know how to use LiveQuery. Every time Ive used containedIn for normal queries works fine. So I know how to use containedIn. Only issue I am having is when I am using containedIn with LiveQuery.
@lsmilek1 says it works with him so the only thing I asked him was what server version he is running. I am not denying that this could very well be a server issue, but I am not here for a tutorial on how to do queries. Rather, I am trying to pin point where the issue is and report it (if need be).
I am not trying to be difficult, I have left this issue closed etc but would be good to see what server version he is running so I can move forward in the right direction.
Every time Ive used containedIn for normal queries works fine. So I know how to use containedIn. Only issue I am having is when I am using containedIn with LiveQuery.
I stated here, you provided examples that are "completely different" from each other, essentially you provided an apples to oranges comparison.
Proper steps to flush out where your problem is:
==
query, find
the results, are they correct?containedIn
query, find
the results, are they correct? (you have not provided anything that shows you have done this the entire thread, thus making it extremely hard to help you)If 1,2, and 3 works and 4 doesn't, then either:
containedIn
, or containedIn
in the version of the server you are using and may support it in a newer versionIf 1 and 2 work, and 3 and 4 doesn't work then either:
containedIn
query incorrectlyIn any of the cases, you should be providing enough information when asking a question or opening an issue. Enough information requires providing your ParseObject
's to understand your setup. In addition, you should take the debugging steps necessary to isolate your problem (1-4 above) and show the results of these steps.
parties is an Array not a pointer.
parties
is an array of what exactly? Your query attempts to treat it as an "array of strings", particularly containing objectId
's. I ask if this is an array of "pointers" to ParseObject
's because if it is, your query is incorrect. If you provided your ParseObject
or what this field looks like in your Parse Dashboard, then this type of question wouldn't need to be asked
As I specified in my original post, the query works perfectly fine, it simply doesn't auto update after the initial fetch.
We will need you to provide necessary information I asked for in the previous comments to determine if it's indeed "perfectly fine."
New Issue Checklist
Issue Description
containedIn query does not update LiveQuery
Steps to reproduce
Subscribe to a LiveQuery with a containedIn, will not update such as:
query = query.where(containedIn(key: "parties", array: [usersProfile.id]))
But a normal equals query seems to update perfectly:
query = query.where("senderID" == "VcF9fMCyKb")
Actual Outcome
Nothing, it will not update at all. Note the query containedIn loads perfectly fine when using fetch or even using the subscribedQuery but will not activate any of the events.
Environment
Client
Server
Database
Logs
When using containedIn
Successfully subscribed to new query Message ({"limit":100,"skip":0,"_method":"GET","where":{"parties":{"$in":["CwyLdNXNAH"]}}}) Saved Message
When using equals to (as you can see it updates both new messages and editing old ones)