Dano007
Dano007

Reputation: 1932

How to create a parse.com pointer to a class other than user?

Looking at this post https://parse.com/questions/pointers-user-with-javascript, I can see how this creates a pointer back to _User, but what if I want to link to another class say "Collection"

I'm guessing I need to switch out Parse.User.current() but what is the format for the class?

Basically I want a one to many pointer created between the classes.

var Mapper = Parse.Object.extend("mapper");
var a_mapper = new Mapper();
a_mapper.set("userPointer", Parse.User.current());
a_mapper.save();

Upvotes: 2

Views: 1386

Answers (1)

Fosco
Fosco

Reputation: 38526

It's as easy as assigning a parse object to a value on another object.

var OtherClass = Parse.Object.extend("otherClass");
var oc = new OtherClass();
a_mapper.set("otherPointer", oc);
a_mapper.save();

Upvotes: 2

Related Questions