So I had a problem when trying to input an array of objects. The ModelArray.from(arr) command does make a model array, but it did not make a model array of models. Which I forced into working by forEaching and setting each object individually with Model.create(obj). But with this I needed to set a foreign key on each item of the array. I was trying to use setAll(field,value) but the error comes up that setAll was not a function.
On top of this, the Model.create(obj).set(field, value) did not function as expected either. So I needed to use an impure function to update each element of my original array, update their keys, and then model.create() each one, to insert them into the database.
Was there something that I was doing wrong? or something i was missing?
So I had a problem when trying to input an array of objects. The ModelArray.from(arr) command does make a model array, but it did not make a model array of models. Which I forced into working by forEaching and setting each object individually with Model.create(obj). But with this I needed to set a foreign key on each item of the array. I was trying to use setAll(field,value) but the error comes up that setAll was not a function. On top of this, the Model.create(obj).set(field, value) did not function as expected either. So I needed to use an impure function to update each element of my original array, update their keys, and then model.create() each one, to insert them into the database. Was there something that I was doing wrong? or something i was missing?