denodb icon indicating copy to clipboard operation
denodb copied to clipboard

Model.count() should return a number (integer)

Open bashovski opened this issue 4 years ago • 1 comments

Right now the method returns a string while querying a Postgres Db.

bashovski avatar Sep 18 '20 21:09 bashovski

Can confirm. This is probably the same underlying issue as denodrivers/postgres#91, if Postgres returns the result of a COUNT-query as a BIG_INTEGER. I've worked around the issue for my specific use case by using parseInt(), as I can ensure, that I will never cross the maximum of a Javascript number type.

I guess it's more difficult to create a generic solution, although there seems to be a proposal in denodrivers/postgres#177, that hasn't gone anywhere yet.

DerNamenlose avatar Dec 22 '20 10:12 DerNamenlose