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

LiveQuery issues #539

Closed
monster555 opened this issue Dec 30, 2020 · 12 comments
Closed

LiveQuery issues #539

monster555 opened this issue Dec 30, 2020 · 12 comments

Comments

@monster555
Copy link

I'm having issues with LiveQuery create event as it isn't firing. Other issue I've noticed is that if my query have multiple whereEqualTo or whereNotEqualTo on debug logs only show the last criteria.

If I have this query

    QueryBuilder<ParseObject> q1 = QueryBuilder<ParseObject>(myClass)
      ..whereEqualTo('field1', 'value1')
      ..whereNotEqualTo('field2, 'value2')
      ..whereNotEqualTo('field2, 'value3');

    QueryBuilder<ParseObject> q2 = QueryBuilder<ParseObject>(myClass)
      ..whereContainedIn('arrayField', arrayValue)
      ..whereNotEqualTo('field2', 'value4')
      ..whereNotEqualTo('field2', 'value5');

    QueryBuilder<ParseObject> mainQuery = QueryBuilder.or(
     myClass,
      [q1, q2],
    )
      ..orderByDescending("createdAt")
      ..setLimit(15);

I'm getting this on my logs:
LiveQuery: : SubscribeMessage: {op: subscribe, requestId: 3, query: {className: myClass, where: {$or: [{field1: value1, field2: {$ne: value3}}, {arrayField: {$in: [arrayValue]}, field2: value5}]}}}

If I run a "normal" query I get the expected results but LiveQuery is not firing every events all the time. I'm listening for all of the events

@RodrigoSMarques
Copy link
Contributor

@monster555
Check instructions for LiveQuery Protocol Specification here

The query.where field is mandatory. It represents the condition of the ParseQuery the client subscribes to. The format of the where field is the same with ParseQuery's REST API format. You can check the detail here. Right now we support $lt, $lte, $gt, $gte, $ne, $in, $nin, $exists, $all, $regex, $nearSphere, $within and normal equal condition. Any unsupported conditions will be ignored.

Operator '$or' is not supported

@dplewis
Copy link
Member

dplewis commented Dec 30, 2020

Is your Live Query Server configured properly?

@monster555
Copy link
Author

Yes, my LiveQuery server is working properly from JavaScript client. I'm using OR QueryBuilder without problems from Flutter but there are some cases that it won't trigger any event.
@RodrigoSMarques I setup my query with QueryBuilder.or as in the docs and I don't think it's the problem here. I don't get any error from my logs.

@RodrigoSMarques
Copy link
Contributor

@monster555

According to the documentation, Parse Server does not support the OR operator in Live Query. Check the link and comment on my previous answer.

The OR operator will work on normal queries, but will not work with LiveQuery

@dplewis
Copy link
Member

dplewis commented Dec 30, 2020

I think the documentation is wrong. here $or is supported. I realize that $and and $nor are missing.

Can anybody try $or in the Javascript Client?

@RodrigoSMarques
Copy link
Contributor

@monster555
Have you updated your version of Parse Server? Do you continue with version 3.2.3?

@dplewis
Is it possible to identify in which version the operator $or was added?
From the documentation, I believe it was inserted in a certain version.

@dplewis
Copy link
Member

dplewis commented Dec 30, 2020

Its been there since the beginning of Live Query.

@dplewis
Copy link
Member

dplewis commented Dec 30, 2020

@monster555 Can you run VERBOSE=1 on your server? What does that output look like?

@monster555
Copy link
Author

The only thing I can see related to the subscription when running with verbose is this:

Raw request from cloud code current : %j | original : %j
Subscribe messsage %j
2jtjb367uNlBOgsGgQTNTFhuvNqqesps1rA6VntAafterSave is triggered
ClassName: %s | ObjectId: %s
Current client number : %d
orderId on delivery: UfNFqwxW3x
Raw request from cloud code current : %j | original : %j
Subscribe messsage %j
2jtjb367uNlBOgsGgQTNTFhuvNqqesps1rA6VntAafterSave is triggered
ClassName: %s | ObjectId: %s
Current client number : %d
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Original %j | Current %j | Match: %s, %s, %s, %s | Query: %s
Push Response : %j

@monster555
Copy link
Author

@RodrigoSMarques I'm on 3.2.3. I've updated to 4.2.0 but started having some error with some aggregate on my Cloud Code

@monster555
Copy link
Author

@RodrigoSMarques just updated to 4.2.0 and still the same.

@RodrigoSMarques
Copy link
Contributor

We are closing issues that have been open for a long time without activity.
This will make it easier to organize things from now on.
If the problem persists, please open a new issue.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants