Querying An Operator Returned Value

I am looking to query the value that was returned by an operator.
In my case, the check if the first element of a returned array is equal to a string

my attempt:

db.movies.aggregate([
  {
    $match: {
      $split: [
        "$awards",
        " "
      ]
    }.0 : {$eq: "Won"}
  }
])

a. Is it possible to query the value that was returned by an operator?
b. How do I access the first element of the array?

Thanks

Hi @Harel_Shattenstein,

Here is my solution.

Pipeline:

[
  {
    '$match': {
      '$expr': {
        '$eq': [
          {
            '$arrayElemAt': [
              {
                '$split': [
                  '$string', ' '
                ]
              }, 0
            ]
          }, 'Yo'
        ]
      }
    }
  }
]

Test:

test [direct: primary] test> db.coll.insertOne({string: "Yo I'm a cool string!"})
{
  acknowledged: true,
  insertedId: ObjectId("6165c0c71b73005154b67178")
}

test [direct: primary] test> db.coll.aggregate([
...   {
.....     '$match': {
.......       '$expr': {
.........         '$eq': [
.........           {
...........             '$arrayElemAt': [
...........               {
.............                 '$split': [
.............                   '$string', ' '
.............                 ]
.............               }, 0
...........             ]
...........           }, 'Yo'
.........         ]
.........       }
.......     }
.....   }
... ])
[
  {
    _id: ObjectId("6165c0c71b73005154b67178"),
    string: "Yo I'm a cool string!"
  }
]

Some doc to help you understand what is going on:

Cheers,
Maxime.

I see where you are going with this but take a look at the document matching

{ title : "La perla" }

That movie Won something. But it was not an Oscar. You might count too many documents with this approach.