title: c# MongoDB camelCased field name while using filters
body: <p>I have a model class which is immutable and mapped to mongo through BsonClassMap.RegisterClassMap. If I understand correctly, when I want to store properties into database with camelCased names convention pack won't work so I have to use SetElementName method to set it manually as following. </p>
  
  <pre><code>BsonClassMap.RegisterClassMap&lt;Document&gt;(cm =&gt;
    {
      cm.MapIdMember(d =&gt; d.Id).SetElementName("id");
      cm.MapProperty(d =&gt; d.SchemaId).SetElementName("schemaId");
      cm.MapProperty(d =&gt; d.Filename).SetElementName("filename");
      cm.MapProperty(d =&gt; d.Content).SetElementName("content");
      cm.MapCreator(d =&gt; new Document(d.Id, d.SchemaId, d.Filename, d.Content));
    });
  </code></pre>
  
  <p>The problem is filtering. I want to filter properties camelCased and for some reason some properties are working, some does not.</p>
  
  <p>This works and results into one document with given Id</p>
  
  <pre><code>var fBuilder = Builders&lt;Document&gt;.Filter;
  fBuilder.Eq("Id", Guid.Parse("9e50b066-4320-4c30-9ce1-e939fb13836d")),
  </code></pre>
  
  <p>This does not.</p>
  
  <pre><code>var fBuilder = Builders&lt;Document&gt;.Filter;
  fBuilder.Eq("id", Guid.Parse("9e50b066-4320-4c30-9ce1-e939fb13836d")),
  </code></pre>
  
  <p>This works, even though it should not in my opinion.</p>
  
  <pre><code>var fBuilder = Builders&lt;Document&gt;.Filter;
  fBuilder.Eq("Filename", "document.json"),
  </code></pre>
  
  <p>Surprisingly this works too and this is what I want for all properties.</p>
  
  <pre><code>var fBuilder = Builders&lt;Document&gt;.Filter;
  fBuilder.Eq("filename", "document.json"),
  </code></pre>
  
  <p>I think it has something to do with types of properties.</p>
  
  <p>Currently I'm using MongoDB.Driver 2.9</p>
  
  <p>Edit: When using SortDefinition for sorting, there is no such a problems and everything works fine</p>