parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Using includeKey: on array of pointers results in error

Open N4tr0n opened this issue 10 years ago • 29 comments

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!

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.

  1. Create a PFQuery on the object's type.
  2. Try to include the array of pointers field using includeKey:
  3. 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)

N4tr0n avatar Mar 31 '16 01:03 N4tr0n

try console.log the object?

flovilmart avatar Apr 05 '16 23:04 flovilmart

Here's the log of the object: { objectId: 'mpImkB2Zyw' } Don't know why the __type and className fields aren't there.

N4tr0n avatar Apr 05 '16 23:04 N4tr0n

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.

flovilmart avatar Apr 06 '16 00:04 flovilmart

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.

N4tr0n avatar Apr 06 '16 00:04 N4tr0n

May be, let's close that for now.

flovilmart avatar Apr 06 '16 00:04 flovilmart

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?

lguerra10 avatar May 14 '16 22:05 lguerra10

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"}]

xissburg avatar Jun 03 '16 14:06 xissburg

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.

xissburg avatar Jun 03 '16 14:06 xissburg

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.

rickyjwhong avatar Jul 27 '16 00:07 rickyjwhong