How to count results from a query #517
-
Hey guys I'm perhaps missing something simple here but how can I go about counting the results of a query? I can grab a range of documents from a query using Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
Hey @andregoldstein! There's a PR here that adds this feature. I'll be updating here when we update the client (should be sometime soon). |
Beta Was this translation helpful? Give feedback.
-
Hummm I think I might be missing something. I just want the count of a query: This works, but I don't think it's efficient?
Seem like this is the recommended solution, but doesn't work for me (returns null):
Any nudges appreciated! |
Beta Was this translation helpful? Give feedback.
-
The const { count, error } = await supabase
.from("properties")
.select("*", { count: "exact", head: true })
if (error) throw error;
console.log(count) // 745
return count; |
Beta Was this translation helpful? Give feedback.
-
How can you do this via an API call instead of using the supabase libary? |
Beta Was this translation helpful? Give feedback.
Hey @andregoldstein! There's a PR here that adds this feature. I'll be updating here when we update the client (should be sometime soon).