I still struggling how can I create and store particular size of objects in sequelize.
Here is my code:
var pointsize = req.body.pointsize;
Point.bulkCreate([{ pointname: req.body.point }]).success(function() {});
I wanna store pointsize count of rows in Point table. Thanks for any advise guys!
Edited:
function makeArrayOf(value, length) {
var arr = [], i = length;
while (i--) {
arr[i] = value + (i+1);
}
return arr;
}
var pointsize = req.body.pointsize;
Point.bulkCreate([makeArrayOf('Point Name', pointsize)]).success(function() { });
something like this... This create me pointsize rows in db (As I wish). But I don't know how to store name of point into database.
So if pointsize = 5 then rows in database will looks like:
id | name | ownerid
---------------------
1 | Point 1 | 101
2 | Point 2 | 101
3 | Point 3 | 101
4 | Point 4 | 101
5 | Point 5 | 101