I am just starting to learn about mongo db and was wondering if I am not doing something wrong .... I have two objects:
public class Part { public Guid Id; public ILIst<Materials> Materials; } public class Material { public Guid MaterialId; public Material ParentMaterial; public IList<Material> ChildMaterials; public string Name; }
When I try to save this particular graph of objects, I get an error due to circular reference. My question is, is there any way around this? In WCF, I can add the IsReference attribute on the datacontract to true, and it serializes just fine.
I was able to accomplish exactly what I needed using the modified driver from NoRM mongodb .
Which driver are you using?
In NoRM, you can create a DbReference like this:
public DbReference<Material> ParentMaterial;
Mongodb-csharp DbReferences, .
public DBRef ParentMaterial;
Database.FollowReference(ParentMaterial).
Database.FollowReference(ParentMaterial)
, , , , ODB NoSQL, .
Hibernate, , - AT ALL , JOIN , b-.
Versant ( - ), , .
, , Java ODB... , , , .....
, 20 , , , )
If you want to store object diagrams with relationships between them requiring multiple “joins” to get the answer, you are probably better off working with a SQL-style database. The document-oriented approach of MongoDB and others is likely to structure this differently.
Take a look at MongoDB nested sets , which offer some ways to represent such data.
Source: https://habr.com/ru/post/1774429/More articles:flickr gem rails 3 - ruby-on-railsASP.NET MVC: best practice or design pattern for getting DTO / EditModel into a database - design-patternsZend Studio 8 performance fix (typing input) Problem - phpIterate over int and string using istream_iterator - c ++Vaguely about how Silverlight gets to a page - asp.net-mvclogical aggregation patterns in C # - c #Distributed Computing Root Space Paradigm for Erlang - erlangHow to override the `is` operator - operatorsMaven archetypes for OpenJPA - mavenКак получить количество атрибутов, которые имеет объект? - c#All Articles