Can't get related users

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?

Hello, @Tony_Goodchild.
This code allows you to pull out all the Users objects that point to a specific objectId

const companyId = 'child ID referenced by Users objects'
Backendless.Data.of('Users').find({ where: `company.objectId = '${ companyId }'` })
  .then(users => {
    console.log(users)
  })
  .catch(error => {
    console.log('server reported an error - ' + error.message)
  })

If you need to get company objects too, try the following:

Backendless.Data.of('Users').find({
  where    : `company.objectId = '${ companyId }'`,
  relations: ['company']
})

Where ‘relations’ is an array of related column names.

Best regards, Nikita.