Using includeKey: on array of pointers results in error
For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
- [x] You've met the prerequisites.
- [x] You're running the latest version of Parse Server.
- [x] You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Environment Setup
Local
Xcode 7.3 iPhone 6s simulator with iOS 9.3 Parse-iOS-SDK 1.13
Remote
heroku/nodejs parse-server 2.2.4 parse 1.8.1
Steps to reproduce
Precondition: There exists an object on the database that has an array of pointers as one of its fields.
- Create a
PFQueryon the object's type. - Try to include the array of pointers field using
includeKey: - Execute the query.
Note: This works correctly my Parse hosted app. It only becomes an issue when I try to use my parse-server hosted on heroku.
Logs/Trace
[Error]: can only include pointer fields (Code: 102, Version: 1.13.0)
try console.log the object?
Here's the log of the object: { objectId: 'mpImkB2Zyw' } Don't know why the __type and className fields aren't there.
Maybe because they have been improperly stored... Are all your objects like that? What's your client code that creates those objects? try removing the throwing, and ignore the unproperly configured objects by returning an empty array, see if many/most of those are improperly stored.
Yeah, that was the problem. I remember we had some issues with this array when adding a web client. Anyway, I found two users that had bad arrays. After I removed the bad arrays the query worked perfectly. I guess on the Parse hosted apps the bad arrays are ignored.
Thanks again for all your help, it is truly appreciated.
May be, let's close that for now.
I have the same problem with arrays of PFUsers and PFFIles. What should I do, rewrite the code so as to avoid this type of arrays or wait for this problem to solved? Is the problem being addressed so that we can expect it to be solved?
I am also getting arrays of pointers like this in my database sometimes:
[{"objectId":"9m2llSTANa"},{"objectId":"Rtu7IEU9cT"}]
Instead of
[{"__type":"Pointer","className":"_User","objectId":"1Nii4IsZc1"},{"__type":"Pointer","className":"_User","objectId":"Glivar389e"}]
In a query when I do this query.includeKey("users") I get no results. When I remove this includeKey I get results but without the users objects of course (I mean, no data available). This is my full query:
let query = Chat.query()!
query.whereKey("users", equalTo: user)
query.includeKey("users")
Funny how if I remove that whereKey I get error can only include pointer fields.
Hello, same error we see here. An array of PFObjects are only returning partial data instead of full, even with includeKey. It works fine with just a single pointer however.