Open valayDave opened 7 years ago
The documentation for saving relational documents and deleting them shows the following:
var Advertizer = thinky.createModel("Advertizer", { name: type.string(), }); var Contract = thinky.createModel("Contract", { advId: type.string(), dateTo: type.date(), dateFrom: type.date() regionId : type.string() }); var Region = thinky.createModel("Region", { name: type.string(), }); Advertizer.hasMany(Contract, "contracts", "id", "advId"); Contract.belongsTo(Advertizer, "advertizer", "advId", "id"); Region.hasMany(Contract, "contracts", "id", "regionId"); Contract.belongsTo(Region, "region", "regionId", "id"); Advertizer.get("3851d8b4-5358-43f2-ba23-f4d481358901").getJoin({contracts:true}).run() .then(function(adv) { adv.contracts.splice(1, 1); adv.saveAll({contracts: true}).then(function(newAdv) { }).error(function(err){ }); });
When I do the adv.saveAll() I get a validation Error saying advId must be defined. I am doing it the same way it is shown on thinky documentation.
What can be the issue?
Maybe because id is not declared in your schema?
id
The documentation for saving relational documents and deleting them shows the following:
When I do the adv.saveAll() I get a validation Error saying advId must be defined. I am doing it the same way it is shown on thinky documentation.
What can be the issue?