title: Using Lambda expression to delete Mongo document, c#
body: <p>I've seen examples here of people doing this same thing, but for some reason I'm getting an error. </p>
  
  <pre><code>IMongoDatabase db = Globals.gdbSourceDB.GetDatabase(Globals.gsWatchDatabase);
  
  ChangeStreamOptions options = new ChangeStreamOptions() { FullDocument = ChangeStreamFullDocumentOption.UpdateLookup };
  
  var pipeline = new EmptyPipelineDefinition&lt;ChangeStreamDocument&lt;BsonDocument&gt;&gt;().Match("{ operationType: { $in: [ 'replace', 'insert', 'update', 'delete' ] } }");
  var changeStream = db.Watch(pipeline, options).ToEnumerable().GetEnumerator();
  while (changeStream.MoveNext())
  {
      ChangeStreamDocument&lt;BsonDocument&gt; next = changeStream.Current;
  
      IMongoDatabase dbDest;
      IMongoCollection&lt;BsonDocument&gt; colDest;
  
      dbDest = Globals.gdbDestDB.GetDatabase(Globals.gsWatchDatabase);
      colDest = dbDest.GetCollection&lt;BsonDocument&gt;(next.CollectionNamespace.CollectionName);
  
      if (next.OperationType.ToString() == "Delete")
      {
          //Delete the same record
          var retDel = colDest.DeleteOne(a =&gt; a.Id == next.DocumentKey);
      }
  
  }
  </code></pre>
  
  <p>I know <code>next.DocumentKey</code> isn't exactly correct, but the problem is with a.Id.  I'm getting the following error:</p>
  
  <blockquote>
    <p>Error CS1061  'BsonDocument' does not contain a definition for 'Id' and
    no accessible extension method 'Id' accepting a first argument of type
    'BsonDocument' could be found (are you missing a using directive or an
    assembly reference?)</p>
  </blockquote>
  
  <p>What am I doing wrong?
  Thanks!</p>