codeetcetera
codeetcetera

Reputation: 3203

Can I set a Parse Object Pointer with the ObjectID

I have a custom cloud code method to create a parse object. I'm doing that so I can validate the uniqueness of a few pointer objects, etc.

When I create the object I need to create, can I set the non validated pointers via the object id I get from the client side?

Something like object.set("user", "someuserid");

I'd like to avoid doing the extra find queries if I can when I already have the id.

Upvotes: 2

Views: 2695

Answers (2)

Pavan Hukerikar
Pavan Hukerikar

Reputation: 1

there is one simple shortcut method you just pass objectId to createWithoutData function

Parse.User.createWithoutData(req.body.objectId);

Upvotes: 0

Russell
Russell

Reputation: 3089

You certainly can so long as you create a new pointer and assign the objectId.

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

There is also a shortcut you can use called createWithoutData

Upvotes: 4

Related Questions