title: Autogenerating values for child/sub-documents in a collection within a MongoDB document
body: <p>My MongoDB collection has documents that can each contain an array of child documents. Each child document needs a way for me to uniquely identify it so that I can replace it or update it later.</p>
  
  <p>How do I tell MongoDB to generate a unique value for each child document within the set?</p>
  
  <p>I'm using the C# MongoDB driver.</p>
  
  <pre><code>{
      _id: 'gd37dg67dg63782gd78',
      name: 'foo'
      docs: [
          {
              idvalue: 'autogenerated',
              y: 10
          },
          {
              idvalue: 'autogenerated',
              y: 10
          },
          {
              idvalue: 'autogenerated',
              y: 10
          },
      ]
  }
  </code></pre>