GithubHelp home page GithubHelp logo

Comments (5)

parse-github-bot avatar parse-github-bot commented on July 20, 2024

Thank you for your feedback. We use the issue tracker here to track valid bugs in our SDK. Your question seems to be more about how to use Parse. Could you check out the following resources?

from parse-sdk-js.

wangmengyan95 avatar wangmengyan95 commented on July 20, 2024

Hi @mik-dass, I don't have the context of the likes and post, but the following is my test code and it works fine
Android side

ParseObject parseuser=ParseObject.createWithoutData(ParseUser.class, "XXXX");
ParseObject object = new ParseObject("likes");
object.put("Owner", parseuser);
object.saveInBackground();

Cloudcode side

Parse.Cloud.useMasterKey();
var owner = request.object.get("Owner");
owner.fetch({
  success: function(owner) {
    owner.set('XX', 'XXX')
    response.success();
  },
  error: function(error) {
    response.error(error);
  }
});

If this still does not work for you, do you get any exception from cloudcode side or android side?

from parse-sdk-js.

mik-dass avatar mik-dass commented on July 20, 2024

@wangmengyan95 Thank you for replying.So basically I should create a new column "owner" to store the id of the post owner. But will that be a good design as it will consist of redundant data ???
What I am trying to do is --

_User table

objectId / attribute

posts

objectId / authorId(pointer to _User)

likes

objectIId / likerId(pointer to _User who likes the post) / postId(ponter to the post liked)

In my cloud code I try to access the attribute of the user class pointed by the posts class.

So I create a _User object without data ,then created a posts object without data and set the authorId equal to the _User object created earlier.Then I created the likes object using the appropriate values and set the postId to the posts object created earlier.I thought this will help me to reduce a query since I did not wanted to fetch the post owner Id in the cloud code consuming a api call . But this approach failed and the cloud log showed me that the reponse object received the posts object as a pointer with no data in it .So am I missing something to be done to make my aprroach work??? Or should I do ahead and use one more api call to fetch the post owner Id??? Or create a new column in the likes class to store objectIds of the post owner??? Please reply.Thank you.

from parse-sdk-js.

wangmengyan95 avatar wangmengyan95 commented on July 20, 2024

Hi @mik-dass, we do not send the nested ParseObject's full data to cloud code. In order to get the data of the nested ParseObject, you have to do a query or fetch.
For the design issue, you can also take a look at here, we have a tutorial about how to implement relations in Parse. Hope it helps.

from parse-sdk-js.

mik-dass avatar mik-dass commented on July 20, 2024

Ok.Thank you .

from parse-sdk-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.