I'm trying to count how many records I have in a table using dexie.js
I try this: alert(db.table.count()); and browser return: [object Dexie.Promise]
If I use console.log(db.table.count()); the console say this:
This table has two records.. I believe that the _value item showing this result, but my problem is that I don't know how I can display this to the user.
I'm a PHP developer and I tried to make a loop and add the results, like this:
var var_quant = 0;
db.table.orderBy("id").toArray()
.then(list => {
list.forEach(item => {
console.log(`${item.name}`);
var_quant = var_quant + 1;
});
})
.catch(error => {
// handle error
});
console.log(var_quant);
And the console displays the names of the bank, but does not add values to the variable var_quant
Any suggestions on how to just get the number of records, in Mysql it was so easy :o.
