Atlas Search Index: Filter out docs with a field that has an empty string

Can I set a filter on a $search stage to filter out any results for a field that is an empty string? Maybe there’s a way to do an equals for this?

Hi @Matt_Jones1,

welcome to MongoDB and the Forums!

I would recommend you to go through compound operator in which you can specify must and must not match of the output.

Please let me know if that helps.



Thank you for the reply. If I use compound with a must operator, then which operator under must will allow me to specify a match only if a field is an empty string?