Count values in array of objects

hello

You can use $reduce ,and keep the array as it is

And make the counting ,without the need to $unwind on server or do something like “unwind” on the driver,on driver only the reduce results could be sended.

1 Like