TGIO / ParseLiveQuery

Very simple and modern implementation, it lacks tests and extra functionality at this moment but i'm working on it.
Apache License 2.0
48 stars 10 forks source link

Relational queries and where clause #4

Closed aleshu closed 8 years ago

aleshu commented 8 years ago

Thank you so much TGIO for your work on this much needed code. I am having trouble trying to build a query with a where clause to retrieve an object with a pointer to another object. The key should be the objectId of the "pointed" object. According to documentation:

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.

So the resulting REST API construct should be:

curl -X GET \
  -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
  -H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
  -G \
  --data-urlencode 'where={"post":{"__type":"Pointer","className":"Post","objectId":"8TOXdXf3tz"}}'

But I can't seem to be able to do something like this as the value of the key is a String and not a JSON. My closest attempt was: {"op":"subscribe","requestId":0,"query":{"className":"Comment","where":{"post":"{"__type":"Pointer","className":"Post","objectId":"8TOXdXf3tz"}"}}} which is not working. Note the String after the "post": which should be a JSON. I am obviously doing something wrong here.

Any help is appreciated and please apologize my English. Thank you!