I have an array of objects and want to insert them in a table but only first one record is inserted and rest are not
data.forEach(function(obj){
mydb.tasks.add(obj);
mydb.saveChanges();
});
here is what I am actually doing
data.forEach(function(obj){
mydb[table].filter("it._id == '"+obj._id+"'")
.toArray( function(objs){
if(!objs.length){
mydb[table].add(obj);
mydb.saveChanges();
}
});
});