我有两个这样的课:
public Class Company { public IList<Employee> Employees; } public Class Employee { public Company WorkPlace; }
当我想保存类公司的对象时:
MongoDatabase Database = MongoServer.GetDatabase("db"); var workPlace = new Company(); var employee = new Employee { WorkPalce = workPlace} workPlace.Employees = new List<Employee>{ employee }; Database.GetCollection<Company>("company").Save(workPlace);
将抛出StackOverFlow异常.