Why doesn't .add() insert value in the column?

后端 未结 1 698
我寻月下人不归
我寻月下人不归 2021-01-26 08:56

I\'m trying sails.js association using one way reference (according to sails.js in action book). Now, the value of owner is su

1条回答
  •  无人及你
    2021-01-26 09:53

    It will not be inserted because its 'virtual' data. When you want to get those data you need to join those 2 tables.

    Driver.find({
    
    }).populate('cars').exec(function(error, drivers){
    
    });
    

    Query sent to database will look more like this

    select * from driver inner join car where driver.id = car.owner
    

    0 讨论(0)
提交回复
热议问题