title: MongoDb: Rename a property in a complex document
body: <p>We have documents saving to MongoDb. The problem is that one of our sub-documents has an <code>Id</code> property that is getting returned as <code>_id</code>, which is causing serialize/deserialize issues with the C# driver due to how it interprets Id fields (see <a href="http://mongodb.github.io/mongo-csharp-driver/2.0/reference/bson/mapping/" rel="nofollow noreferrer">http://mongodb.github.io/mongo-csharp-driver/2.0/reference/bson/mapping/</a>)</p>
  
  <p>I would like to rename the property from <code>Id</code> to <code>SetId</code>, but our data is fairly dynamic and simple field rename solutions that I've seen elsewhere do not apply. Here's an example of some heavily edited simple data:</p>
  
  <pre><code>{
    "Id": "5a6238dbccf20b38b0db6cf2",
    "Title": "Simple Document",
    "Layout": {
      "Name": "Simple Document Layout",
      "Tabs": [
        {
          "Name": "Tab1",
          "Sections": [
            {
              "Name": "Tab1-Section1",
              "Sets": [
                {
                  "Id": 1
                }
              ]
            }
          ]
        }
      ]
    }
  }
  </code></pre>
  
  <p>Compare with more complex data:</p>
  
  <pre><code>{
    "Id": "5a6238dbccf20b38b0db6abc",
    "Title": "Complex Document",
    "Layout": {
      "Name": "Complex Document Layout",
      "Tabs": [
        {
          "Name": "Tab1",
          "Sections": [
            {
              "Name": "Tab1-Section1",
              "Sets": [
                {
                  "Id": 1
                }
              ]
            },
            {
              "Name": "Tab1-Section2",
              "Sets": [
                {
                  "Id": 1
                }
              ]
            }
          ]
        },
        {
          "Name": "Tab2",
          "Sections": [
            {
              "Name": "Tab2-Section1",
              "Sets": [
                {
                  "Id": 1
                }
              ]
            }
          ]
        },
        {
          "Name": "Tab3",
          "Sections": [
            {
              "Name": "Tab3-Section1",
              "Sets": [
                {
                  "Id": 1
                },
                {
                  "Id": 2
                }
              ]
            }
          ]
        }
      ]
    }
  }
  </code></pre>
  
  <p>Note that the <code>Set.Id</code> field can be on multiple tabs on multiple sections with multiple sets. I just don't know how to approach a query to handle renaming data at all these levels.</p>