Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
myinvestor.prototype.saveChosenStocks = function (stocks, callback) {
// http://express-cassandra.readthedocs.io/en/latest/batch/
var queries = [];
for (var i = 0; i < stocks.length; i++) {
var stock = stocks[i];
var chosenStock = new models.instance.ChosenStock({
category: stock.category,
exchange_name: stock.exchange_name,
stock_symbol: stock.stock_symbol
});
var saveQuery = chosenStock.save({ return_query: true });
queries.push(saveQuery);
}
models.doBatch(queries, function (err) {
callback(err, stocks.length);
});
}