MongoDB C# driver - serialization of POCO references? -
i'm researching mongodb @ moment. it's understanding official c# driver can perform serialization , deserialization of pocos. haven't found information on yet how reference between 2 objects serialized. [i'm talking represented 2 seperate documents, id links, rather embeded documents.
can serialization mechanism handle kind of situation? (1):
class thing { guid id {get; set;} string name {get; set;} thing relatedthing {get; set;} }
or have sacrifice oop, , this? (2) :
class thing { guid id {get; set;} string name {get; set;} guid relatedthing_id {get; set;} }
update:
just couple of related questions then...
a) if serializer able handle situation (1). example of how without using embedding?
b) if using embedding, possible query across 'things' regardless of whether 'parents' or embedded elements? how such query like?
the c# driver can handle serializing class containing reference instance of (1). however:
- as surmised, use embedding represent this
- there must no circular paths in object graph or stack overflow occur
if want store separate documents have use second class (2) , multiple inserts.
querying across multiple levels not possible when object stored 1 large document nested embedding. might want @ alternatives like:
Comments
Post a Comment