laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

What's the equivalent of SELECT COUNT(column_name)?

Open Gabsys opened this issue 3 years ago • 0 comments

How can we retrieve the size of an array in the get() function?

Update: Ultimately, I want to get the size of the array column for each qualified document

Example, for each document, I have an array of members data. Therefore, I would like to know for each document, how many members are there.

From Laravel's perspective, I could just load the entire member list for all qualified records and use count() to get the array size in blade template. But I wanna avoid that because it will cause loading issue if the member list for each record is huge.

Gabsys avatar May 25 '22 12:05 Gabsys