Srinivas
Srinivas

Reputation: 307

saving pointer with objectId in Parse.Cloud

I am using parse cloud function to some filtering in user table. i have extracted user's objectId and doing some grouping. After that i am having just user's objectId as a string. But now i need to save this objectId as Pointer to the users in another table like in iOS

PFObject *object = [PFObject objectWithoutDataWithClassName:@"Post"objectId:@"objectId"];

Any suggestion to do this in cloud code.

thanks in advance.

Upvotes: 3

Views: 2010

Answers (1)

Héctor Ramos
Héctor Ramos

Reputation: 9258

The equivalent in JavaScript, for a PFUser pointer, would be:

 var userPointer = Parse.User.createWithoutData("myObjectId") ;

This applies to any other class that extends Parse.Object. For example, say that you have a "Foo" class:

 var Foo = Parse.Object.extend("Foo");
 var pointerToFoo = Foo.createWithoutData("myObjectId");

...will work just as well as:

 var Foo = Parse.Object.extend("Foo");
 var pointerToFoo = new Foo();
 pointerToFoo.id = "myObjectId";

Upvotes: 6

Related Questions