Atlas Search Array Size

Does $search support querying for array size?

e.g. countries is an array field in collection products - retrieve all retrieve all products that are sold in more than 3 countries.


Hi @Prasad_Kini and welcome to the MongoDB community forum!!

In today’s date, this is not possible to do it using the $search operator. However, to query the array size, you can use the $size operator in the stage after $search stage of the pipline.

I also see a feedback suggestion at our feedback engine. Linking it here for the future reference and upvoting for the feature request.

Let us know if you have any further questions.

Best Regards

Thanks Aasawari. Running $size after $search takes a big hit on performance and is unusable.

I was the one to post the feedback suggestion a few days back on this :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.