I don't know if it is possible.

I'm trying to do an automatic process to update all elements of a nested array in some documents. The array hasn't a fixed length.

Below is a simplified example of the collection:

```
{
    "_id" : ObjectId("5ba2e413a4dd01725a658c63"),
    "MyOwnID" : "123456789",
    "MyArray" : [ 
        {
            Field1: 'FooName1',
            Field2: 'FooSpec1',
            FieldToUpdate: '...'
        },
        {
            Field1: 'FooName1',
            Field2: 'FooSpec2',
            FieldToUpdate: '...'
        },
        {
         ... More elements ...
        }
    ]
},
{
    "_id" : ObjectId("5ba2e413a4dd01725a658c63"),
    "MyOwnID" : "987654321",
    "MyArray" : [ 
        {
            Field1: 'FooName1',
            Field2: 'FooSpec1',
            FieldToUpdate: '...'
        },
        {
            Field1: 'FooName2',
            Field2: 'FooSpec2',
            FieldToUpdate: '...'
        },

    ]
}

```

I tried and it worked for the first element: 

Query for the second element:

```
db.getCollection('works').findOneAndUpdate(
    { MyOwnID: '123456789', '$and':[ { 'MyArray.Field1': 'FooName1' },{ 'MyArray.Field2': 'FooSpec1' } ] } , 
    { '$set': { 'MyArray.$.FieldToUpdate': 1234} } 
) 

```

But when I try to update the second element only the first is updated.

Query for the second element:

```
db.getCollection('works').findOneAndUpdate(
        { MyOwnID: '123456789', '$and':[ { 'MyArray.Field1': 'FooName1' },{ 'MyArray.Field2': 'FooSpec2' } ] } , 
        { '$set': { 'MyArray.$.FieldToUpdate': 4321} } 
    ) 

```

I tried with arrayFilters option and $elemMatch, both give me an error.

Any options?