title: MongoDB  C# driver - serialization of POCO references?
body: <p>I'm researching <a href="http://en.wikipedia.org/wiki/MongoDB" rel="noreferrer">MongoDB</a> at the moment.  It's my understanding that the official C# driver can perform serialization and deserialization of <a href="http://en.wikipedia.org/wiki/Plain_Old_CLR_Object" rel="noreferrer">POCOs</a>.  What I haven't found information on yet is how a reference between two objects is serialized. [I'm talking about something that would be represented as two seperate documents, with ID links, rather than embeded documents.</p>
  
  <p><strong>Can the serialization mechanism handle this kind of situation? (1):</strong></p>
  
  <pre><code>class Thing {
      Guid Id {get; set;}
      string Name {get; set;}
      Thing RelatedThing {get; set;}
  }
  </code></pre>
  
  <p><strong>Or do we have to sacrifice some OOP, and do something like this? (2) :</strong></p>
  
  <pre><code>class Thing {
      Guid Id {get; set;}
      string Name {get; set;}
      Guid RelatedThing_ID {get; set;}
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Just a couple of related questions then...</p>
  
  <p><strong>a) If the serializer is able to handle situation (1).  What is an example of how to do this without using embedding?</strong></p>
  
  <p><strong>b) If using embedding, would it be possible to query across all 'Things' regardless of whether they were 'parents' or embedded elements? How would such a query look like?</strong></p>