I am trying to count the number of documents in a table that satisfy a condition.
My code in node:-
const [washingCount, washedCount, dirtyCount] = await Promise.all([
pool.query("SELECT COUNT(*) FROM clothes WHERE status = 'washing'"),
pool.query("SELECT COUNT(*) FROM clothes WHERE status = 'washed'"),
pool.query("SELECT COUNT(*) FROM clothes WHERE status = 'dirty'")
])
But I am getting the error saying:
error: column "count" does not exist
And when I copy the same query over to PostgreSQL CLI, those output the desired results.
For full code refer:- https://github.com/js313/clothio/blob/master/index.js
What am I missing here?
Thank you.


curl -XGET http://localhost:300/clothes/countafter starting the app on your local machine and see what happens.