1

I am writing get service in node js api . We are using Objectionjs as ORM module. We have two Table 'RoleDescription' and 'Features'. Features is master table and RoleDescription is child table.

here how it is linked:

const { Model } = require('objection');
const BaseModel = require('./BaseModel')
const Features = require('./Features')
class RoleDescription extends BaseModel {
    static get tableName() {
        return 'RoleDescription';
      }  
      static get relationMappings() {
        return {
    
          featureRelation: {
            relation: Model.HasOneRelation,
            modelClass: Features,
            join: {
              from: 'Features.Id',
              to: 'RoleDescription.FeatureId'
            }
          },
    
    
        }
      }
}  
module.exports = RoleDescription

Since, I want to get all data from features table in response . joinEager method does not solve the purpose beacuse i think its inner join.

so, i just want to know how to execute left join using objectionjs.

also wanted to know the difference between joinEager and Joins in objectionjs?

0 Answers0