title: MongoDB .NET Core: No array filter found with BulkWrite
body: <p>I am trying to perform an update many with BulkWrite with mongodb c# driver.
  I have the following code.
  I get the error &quot;No array filter found for identifier 'template' in path 'PartialTemplates.$[template]._id'&quot;</p>
  <pre><code>        var collection = data.Database.GetCollection&lt;BsonDocument&gt;(&quot;TemplateCollection&quot;);
          var filter1 = Builders&lt;BsonDocument&gt;.Filter.In(&quot;_id&quot;, _ids1);
          var filter2 = Builders&lt;BsonDocument&gt;.Filter.In(&quot;_id&quot;, _ids2);
          var filter3 = Builders&lt;BsonDocument&gt;.Filter.In(&quot;_id&quot;, _ids3);
  
          var id1Update = Builders&lt;BsonDocument&gt;.Update
              .Set(&quot;PartialTemplates.$[template]._id&quot;, _id1);
          var id2Update = Builders&lt;BsonDocument&gt;.Update
              .Set(&quot;PartialTemplates.$[template]._id&quot;, _id2);
          var id3Update = Builders&lt;BsonDocument&gt;.Update
              .Set(&quot;PartialTemplates.$[template]._id&quot;, _id3);
  
          var arrayFilters = new List&lt;ArrayFilterDefinition&gt;
          {
              new BsonDocumentArrayFilterDefinition&lt;BsonDocument&gt;(new BsonDocument(&quot;template.Type.Key&quot;, &quot;TemplateType&quot;)),
          };
  
          var updateManies = new List&lt;UpdateManyModel&lt;BsonDocument&gt;&gt;
          {
              new UpdateManyModel&lt;BsonDocument&gt;(filter1, id1Update)
              {
                  ArrayFilters = arrayFilters
              },
              new UpdateManyModel&lt;BsonDocument&gt;(filter2, id2Update)
              {
                  ArrayFilters = arrayFilters
              },
              new UpdateManyModel&lt;BsonDocument&gt;(filter3, id3Update)
              {
                  ArrayFilters = arrayFilters
              }
          };
  
          var result = await collection.BulkWriteAsync(updateManies);
  </code></pre>
  <p>One of the documents looks like this</p>
  <pre><code>            new BsonDocument
              {
                  [&quot;_id&quot;] = Guid.Parse(&quot;6da07681-bd40-4fad-8c69-221e186ee6ae&quot;),
                  [&quot;PartialTemplates&quot;] = new BsonArray
                  {
                      new BsonDocument
                      {
                          [&quot;_id&quot;] = Guid.Parse(&quot;0fcb486b-2b30-481e-b44f-388481a9efe1&quot;),
                          [&quot;Type&quot;] = new BsonDocument
                          {
                              [&quot;Key&quot;] = &quot;TemplateType&quot;
                          }
                      },
                      new BsonDocument
                      {
                          [&quot;_id&quot;] = Guid.Parse(&quot;0fcb486b-2b30-481e-b44f-388481a9efe1&quot;),
                          [&quot;Type&quot;] = new BsonDocument
                          {
                              [&quot;Key&quot;] = &quot;WrongKey&quot;
                          }
                      }
                  }
              }
  </code></pre>
  <p>Why is this not working?</p>