Do I need to retrieve an object before saving it as data object relationship?

Hey guys, I have the current customEvent that saves a new Shop object:

‘use strict’;
Backendless.ServerCode.customEvent(‘testSave’, request => {
var myShop = new Shops( {
Name: “Shop 1”
return Backendless.Persistence.of(‘Shops’).save(myShop).then(
success => {
return({“response”:“shop saved”});
},err => {
},err => {

function Shops(args) {
args = args || {};
this.Name = args.Name || “Default Shop Name”;
this.___class = ‘Shops’;

It works well. Now I want to add a data relationship to the class ShopItem (one to one). I already have the objectId of the ShopItem, because it already exists in the database. I don’t want to create a new ShopItem from scratch.

Here is the question: do I need to retrieve the ShopItem first, and then save it as a “relation” in the Shop function, or can I use some shortcut by saving only the relationship in the Shop function (i.e. just put the ShopItem objectId somewhere, without retrieving the object itself)

Thanks guys!



Establishing a relationship having only object IDs is not possible yet. You have to first retrieve the object and then save a parent with a relation.

Ok Sergey, thanks