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

Hi @Prasad_Kini,

My apologies for the delay. I have created below search index in my sample_mflix movies collection:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "plot": {
        "type": "string"
      },
      "runtime": {
        "type": "number"
      }
    }
  }
}

And with below search query, I got the empty record for the given field:

MongoDB Enterprise mflix-shard-0:PRIMARY> db.movies.aggregate([ {
    $search: {
        compound: {
            must: [{
                text: {
                    query: "titanic",
                    path: "plot"
                }
            }],
            mustNot: [{
                range: {
                    "gt": 1,
                    path: "runtime"
                }
            }]
        }
    }
}, {
    $project: {
        countries: 1,
        _id: 1,
        runtime: 1,
        plot: 1
    }
}])
{ "_id" : ObjectId("573a1394f29313caabce0bcb"), "plot" : "An account of the ill-fated maiden voyage of RMS Titanic in 1912.", "runtime" : "", "countries" : [ "USA" ] }
MongoDB Enterprise mflix-shard-0:PRIMARY>

Above query returned empty string for the runtime field.

I hope this answer your question.

Thanks,
Darshan