Hi.
I've been using a query in a iOS app, that worked fine with parse hosted services,
but after trying with a local parse server it returns the error improper usage of $select error.
For NDA reasons, I had to change the names of the classes, attributes, tokens and keys in this ticket.
This is the query I'm using:
override func queryForTable() -> PFQuery {
let query = PFQuery(className: "C1");
let auxQuery = PFQuery(className: "C1");
query.whereKey("A1", matchesKey: "A2", inQuery: auxQuery);
query.includeKey("A3");
query.includeKey("A2");
query.orderByDescending("createdAt");
return query;
}
A1 and A2 are pointers to objects of the same type. I tried the same query with simple types,
but the error still happens. If I comment the whereKey line, the query works perfectly and I get my results.
I ran the parse server with VERBOSE=1 and this is what I got:
GET /parse/classes/C1 { host: 'localhost:1337',
'x-parse-client-version': 'i1.12.0',
accept: '*/*',
'x-parse-session-token': 'a-valid-session-token',
'x-parse-application-id': 'my-application-id',
'x-parse-client-key': 'my-client-key',
'x-parse-installation-id': 'my-installation-id',
'x-parse-os-version': '9.2 (15D21)',
'accept-language': 'en-us',
'accept-encoding': 'gzip, deflate',
'content-type': 'application/json; charset=utf-8',
'content-length': '169',
'user-agent': 'projname/1 CFNetwork/758.2.8 Darwin/15.3.0',
connection: 'keep-alive',
'x-parse-app-build-version': '1',
'x-parse-app-display-version': '1.0' } {
"where": {
"A1": {
"$select": {
"query": {
"className": "C1"
},
"key": "A2"
}
}
},
"include": "A3,A2",
"order": "-createdAt",
"limit": "3"
}
error: ParseError { code: 102, message: 'improper usage of $select' }
After this, I tried running the queries manually with curl requests. I tried querying
my local parse server and the hosted service. This is the result:
> curl -X GET -H "X-Parse-Application-Id: my-application-id" -H "X-Parse-REST-API-Key: my-rest-api-key" -G --data-urlencode 'where={"A1": {"$select": {"query": {"className": "C1"},"key": "A2"}}}' --data-urlencode 'include=A3,A2' --data-urlencode 'limit=3' --data-urlencode 'order=-createdAt' http://localhost:1337/parse/classes/C1
{"code":102,"error":"improper usage of $select"}
> curl -X GET -H "X-Parse-Application-Id: my-application-id" -H "X-Parse-REST-API-Key: my-rest-api-key" -G --data-urlencode 'where={"A1": {"$select": {"query": {"className": "C1"},"key": "A2"}}}' --data-urlencode 'include=A3,A2' --data-urlencode 'limit=3' --data-urlencode 'order=-createdAt' https://api.parse.com/1/classes/C1
{"results":[{"createdAt":"2016-02-10T22:36:04.828Z","A4":10,"objectId":"sgFcN9g3d5", ...]}}
(This last result is cut short, again to avoid NDA issues, but it's the right result.)
Do you have any idea of what is wrong here?
Thanks in advance.
Hi.
I've been using a query in a iOS app, that worked fine with parse hosted services,
but after trying with a local parse server it returns the error
improper usage of $select error.For NDA reasons, I had to change the names of the classes, attributes, tokens and keys in this ticket.
This is the query I'm using:
A1 and A2 are pointers to objects of the same type. I tried the same query with simple types,
but the error still happens. If I comment the
whereKeyline, the query works perfectly and I get my results.I ran the parse server with
VERBOSE=1and this is what I got:After this, I tried running the queries manually with curl requests. I tried querying
my local parse server and the hosted service. This is the result:
(This last result is cut short, again to avoid NDA issues, but it's the right result.)
Do you have any idea of what is wrong here?
Thanks in advance.