In my Users table I have added a column “company”. This is a 1:1 relationship with a row in the companies table.
I am trying to retrieve all users that are related to a specific company.
So far I have this:
var companyId = **the company objectId **;
var loadRelationsQueryBuilder;
loadRelationsQueryBuilder = Backendless.LoadRelationsQueryBuilder.create();
loadRelationsQueryBuilder.setRelationName( "companies" );
Backendless.Data.of( "Users" ).loadRelations(
companyId,
loadRelationsQueryBuilder )
.then( function( users ) {
console.log(users)
})
.catch( function( error ) {
console.log( "server reported an error - " + error.message );
});
even through I am passing in a valid objectId from the comapnies table and there are users with that company as a relation all I am receiving back is an empty array.
Where have I gone wrong here?