Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

includeKey(s) not working? #30

Closed
wosheesh opened this issue Apr 29, 2016 · 15 comments
Closed

includeKey(s) not working? #30

wosheesh opened this issue Apr 29, 2016 · 15 comments

Comments

@wosheesh
Copy link

wosheesh commented Apr 29, 2016

When querying and using includeKey or includeKeys for Pointer-types, the referred objects are not loaded. Is this working as intended in ParseLiveQuery or am I doing something wrong?

Query declaration:

    var messagesQuery: PFQuery {
        return (Message.query()?
            .whereKey("roomId", equalTo: currentChatRoom!.objectId!)
            .includeKeys(["author", "room"])
            .orderByAscending("createdAt"))!

Subscription:

    subscription = liveQueryClient
        .subscribe(messagesQuery)
        .handle(Event.Created) { _, message in
            print("message author.objectId : \(message.author.objectId)")
        }

The last line produces error:
[__NSCFDictionary objectId]: unrecognized selector sent to instance

@CiraciNicolo
Copy link

Is author an 'Object' type on Parse? If so, the error is correct.

@wosheesh
Copy link
Author

wosheesh commented May 3, 2016

It is a PFObject. Why is the error correct? In another place in my code I have a similar query not handled by LiveQuery, also pointing to a user Object and same call results without error.

@wosheesh
Copy link
Author

wosheesh commented May 3, 2016

Is this because Pointers are not yet supported? #31 #16

@xissburg
Copy link

xissburg commented Jun 4, 2016

Pointers are not yet supported? Then what's the point?

@xissburg
Copy link

xissburg commented Jun 9, 2016

I thought I could work around it in a way... but nor the current session, nor ACLs are supported. This is still extremely limited and not very useful.

@AmbroiseCollon
Copy link

I have encountered the same issue. Live query without pointers is really limited. Any schedule on this ? How can we help ? What about includeKeys ? Thanks

@agordeev
Copy link
Contributor

I'm having the same problem. Here's more info: #40

@AmbroiseCollon
Copy link

Any timeline on this ? How can we contribute ? Thanks !

@agordeev
Copy link
Contributor

The problem is LiveQuery returns NSDictionary instead of PFObject.

@Patrez
Copy link

Patrez commented Mar 13, 2017

Any progress on this issue ? I've noticed that the object encoding/decoding is fixed so LiveQuery is returning PFObject. However you don't receive the full object even though the query contains includeKey.

@flovilmart
Copy link
Contributor

@Patrez this is a server side issue, the includeKey is ignored when subscribing to the query. The decision tree is processed synchronously after an object is saved on parse-server, therefore we don't have the opportunity to inject inclusions. We'd need to refactor the whole serverside logic in order to support those.

@Patrez
Copy link

Patrez commented Mar 13, 2017

Oh I understand and do you think that parse-server will support includeKey and LiveQueries? Should I create an issue on parse-server?

@flovilmart
Copy link
Contributor

Pull requests are welcome, if this is a feature of interest, we may start the refactor that may enable more powerful live queries. Note that this will have a negative impact performance, forcing a 'read' on the DB after each save that matches the query. It was designed to not have such impact. Do you want to tackle that in a pull request?

@rafaelmaroxa
Copy link
Contributor

Definitely interested in this.

@hatimmakki
Copy link

Is there a solution for this?

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

No branches or pull requests

9 participants