Skip to content Skip to sidebar Skip to footer

Why Doesn't .add() Insert Value In The Column?

I'm trying sails.js association using one way reference (according to sails.js in action book). Now, the value of owner is successfully inserted in owner column, but value in cars

Solution 1:

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

Post a Comment for "Why Doesn't .add() Insert Value In The Column?"