Closed The-MAZZTer closed 3 years ago
actually column Country
does not exist & that's why the error. But column country
exist.
so this will work -
count({
from: "Customers",
where: {
country: "USA"
}
})
The count api does not have implementation of column checking but select api have, so select will throw a proper message -
I will add column check in count api.
It looks like something was wrong with my original query, possibly the index for the column name did not exist (though that should have not been possible) but I can no longer recreate the problem.
Seeing the same error in idbstudio I thought I had reproduced it.
@The-MAZZTer fixed in version - 3.12.1 . Please update the package and check.
Observed in version 3.12.0 running in Chrome Version 90.0.4430.11 (Official Build) dev (64-bit)
https://ujjwalguptaofficial.github.io/idbstudio/?db=Demo&query=count(%7B%0A%20%20%20%20from%3A%20%22Customers%22%0A%7D)%0A`
The demo query works:
This does not:
Error Message is: Cannot read property 'columns' of undefined. jsstore.worker.js line 1173 in Base.prototype.getColumnInfo (this object is Count Instance).
Error occurs because the function expects Count Instance to have a tableName property with the current object store name, but it does not.
It looks like the Count Instance constructor fails to populate this field, which other classes for the other query types do.
The constructor starts at line 7285:
I modified it to:
This appears to resolve the core problem. However a proper fix should include an error message if the caller fails to provide a proper from field and only provides a where, which this fix does not do.