How to apply $ne using $searchMeta?

I’m counting documents based on specific filters.

What is the proper way to add this line "att": {"$ne": []} to this aggregation pipeline?

Note that I’m using $searchMeta way for better speed!

my_collection.aggregate(
    [
        {
            "$searchMeta": {
                "index": "MsgAtlasIndex",
                "compound": {
                    "must": [
                        {"equals": {"path": "evnt.st", "value": 1}},
                        {"range": {"path": "ts", "gte": new Date(Date.now() - 24*60*60 * 1000)}},
                        {"text": {"query": "violent", "path": "evnt.tag"}},
                        {"equals": {"path": "evnt.cls", "value": True}},
                    ]
                },
            },
        },
    ]
)

Hi @ahmad_al_sharbaji ,

It is recommended to remove the field when the value is an empty array. Then you can implement this filter logic with the exists operator.