title: How to map a Id propertie with existing GUID in BsonClassMap with C# in MongoDb
body: <p>try to map the id property from a derived class with a given GUID with  BsonClassMap.RegisterClassMap() method.</p>
  <pre><code> public class SensorDefinition : IEntity, IAggregateRoot
      {
          public SensorDefinitionId Id { get; }
          private string _name;
          private string _description;
          private string _version;
          private int _numberChannels;
  } 
  
  public class SensorDefinitionId : TypedIdValueBase
      {
          public SensorDefinitionId(Guid value) : base(value)
          {
          }
      }
  
  
  
   public abstract class TypedIdValueBase : IEquatable&lt;TypedIdValueBase&gt;
      {
          public Guid Value { get; }
  
          protected TypedIdValueBase(Guid value)
          {
              if (value == Guid.Empty)
              {
                  throw new InvalidOperationException(&quot;Id value cannot be empty!&quot;);
              }
  
              Value = value;
          }
  
  And the mapping class:
  
    BsonClassMap.RegisterClassMap&lt;SensorDefinition&gt;(map =&gt;
              {
                  //map.AutoMap();
                  map.MapField(&quot;_name&quot;).SetElementName(&quot;Name&quot;);
                  map.MapField(&quot;_description&quot;).SetElementName(&quot;Description&quot;);
                  map.MapField(&quot;_version&quot;).SetElementName(&quot;Version&quot;);
                  map.MapField(&quot;_numberChannels&quot;).SetElementName(&quot;NumberChannels&quot;);
                  map.MapIdProperty(_ =&gt; _.Id).SetElementName(&quot;Id&quot;);
              });
  </code></pre>
  <p>The problem: in the database there is no guid value in the ID.</p>
  <p>How does it look like the correct map code for the id? thx.</p>