unexpected change non id field name in BSON document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 1.9.2, 2.0
    • Component/s: Serialization
    • None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      I want to serialize following class:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      public class TestModel_CustomNotId
      {
          [BsonElement("id")]
          public ObjectId Id { get; set; }
      }
      

      I expected Id field to be serialized as "id",
      but the result BSON document is containing "_id" field.

      fix example:
      https://github.com/ExM/mongo-csharp-driver/commit/264d2d912d73ddad5ebb9edc91f765a03f33e450

            Assignee:
            Unassigned
            Reporter:
            Anatoliy Koperin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: