0

I have two arrays in my _User table: hasCreated and isMemberOf that hold group objects belonging to a Group table.

When I POST to a Group, it happens as expected, but when I GET User with

includeKey=isMemberOf&hasCreated

I get the following:

hasCreated: [
    {
        __type: Object,
        className: Group,
        createdAt: 2014 - 06 - 04T18: 59: 02.325Z,
        createdById: abc,
        …
    }
    {
        __type: Pointer,
        className: Group,
        objectId: def
    }
    {
        __type: Pointer,
        className: Group,
        objectId: ghi
    }]
isMemberOf: [
    {
        __type: Object,
        className: Group,
        createdAt: 2014 - 06 - 04T18: 59: 02.325Z,
        createdById: abc,
        …
    }
    {
        __type: Pointer,
        className: Group,
        objectId: def
    }
    {
        __type: Pointer,
        className: Group,
        objectId: ghi
    }]

So basically, I only get back one of the three groups in its entirety, and the _type fields are different as well. Here is what I have in the User table in both hasCreated and isMemberOf array fields:

[{
    "__type": "Pointer",
    "className": "Group",
    "objectId": "abc"
}, {
    "__type": "Pointer",
    "className": "Group",
    "objectId": "def"
}, {
    "__type": "Pointer",
    "className": "Group",
    "objectId": "ghi"
}]

What am I doing wrong? I need to get the full objects for each of the groups. Please advise! Thanks!

8
  • could you provide your query also that you firing for to GET. It seems like something is wrong with your query only. As if data is there then parse would provide you with it. Commented Jun 11, 2014 at 11:45
  • Look for all the headers here: dropbox.com/s/8yrub5n6aly8li2/headerspdf.pdf Look for the response here: dropbox.com/s/j810624123zyot5/responsepdf.pdf Commented Jun 11, 2014 at 15:46
  • I went through your response, so it is clear and simple. You save the object that you get fully and use all the other pointer's to fetch data about other user details. Commented Jun 12, 2014 at 4:24
  • Yep, but the idea was to figure out how to inflate all pointers onto objects when I first get the response. Although very very unreliably, include instead of includeKey does the right thing. It doesn't do it all the time – sometimes it does and other times the server just sends back an error. Commented Jun 12, 2014 at 4:29
  • The way to get data from pointer is only by fire a query for that pointer and no other way. As you would have created a table containing pointer in fields. So create a function with pointer parameter and pass objectId or pointer to it and fire your query. Include work's fine and I didn't faced anything like sometime does and some time doesn't thing. Still if you got a way do let me know and I will look-in for alternative for you. Commented Jun 12, 2014 at 4:34

1 Answer 1

1

The parse data that you create will provide you only pointer's of other user. So in order to get the data of other user you will have to save those pointer's or objectId that you get from query you fire. Then you could use those objectId or pointer to again fire a query to fetch data of other member's. So I said that you could create another function which accept's pointer or array(containing objectId's) as parameter and in that function you could fire query's to fetch data depending on of objectId ,and at same time as you get detail's you could populate your view with that data. – walle84 41 mins ago

But my concern is that as your list of object is long then it would take a long time and also would effect you view as it won't let you update it until it's done or might crash. So to make your view update ,you could run these query's in different thread's using dispatch method's ,just like parallel thread but not on main thread. This way user will be able to interact with view ,also do handle the view appropriate way as in not letting it to crash. For suggestion till detail are populating you could show activity indicator or progress bar.Still not much idea about your app usage or feel n look – walle84 38 mins ago

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.