I can’t find in javascript docs how can use findbyid method with features of find(query) like setting of properties and relations. I’m aware that you can set number argument to retreive all relations, but I want to be able to choose what needs to be retreived.
It’s possible for REST call, so I guess it should be possible for javascript SDK
Hi Yuriy,
To retrieve the relations of the object you can use method ‘findById’ in this way.
Backendless.Persistence.of( Client ).findById({
objectId: objectId,
relationsDepth: 2
},
new Backendless.Async(console.log, console.error)
);
Regards, Ilya
Hi Ilya, thanks but no, I specifically wrote “I’m aware that you can set number argument to retreive all relations,
but I want to be able to choose what needs to be retrieved”.
But I see that you recommend use of object argument (not documented) - can I also set relations/properties there?
Backendless.Persistence.of( Client ).findById(
{objectId: objectId, loadRelations: "monitor,user", relationsDepth: 2 },
new Backendless.Async(console.log, console.error)
);
- where ‘monitor’ and ‘user’ are names of related columns in table ‘Client’.
About properties - what kind of properties do you want to use withfindById
?
Regards, Ilya
Thanks, “loadRelations” did the job! As to the properties - I mean the same properties = [] I can configure in DataQuery of find method
Oh, yes. I understood what you meant.
Unfortunately, the property ‘properties’ is not available for setting to method ‘findById’.
Regards Ilya