I have added a user to my mongodb collection called users using this model:
[BsonRepresentation(BsonType.ObjectId)]
public ObjectId _id { get; set; }
[Display(Name = "Password:")]
public string Password { get; set; }
[Display(Name = "Confirm:")]
public string ConfirmPassword { get; set; }
[Display(Name = "Email:")]
public string Email { get; set; }
[Display(Name = "Username:")]
public string UserName { get; set; }
[Display(Name = "Firtname:")]
public string Firstname { get; set; }
[Display(Name = "Lastname:")]
public string Lastname { get; set; }
[Display(Name = "Country:")]
public string Country { get; set; }
[Display(Name = "City:")]
public string City { get; set; }
[Display(Name = "Birthdate:")]
public int Birthdate { get; set; }
public List<Team> Teams { get; set; }
as you can se it also have a list of teams in it. So now im using this code to get the user:
var query_id = Query.EQ("_id", ObjectId.Parse(Session["ID"].ToString()));
User entity = Context.Users.FindOne(query_id);
And now i want to add a list to the mongodb object with the data from my team model:
public int TeamID { get; set; }
public string TeamName { get; set; }
public string UserName { get; set; }
public int LeagueID { get; set; }
public Points Points = new Points();
public List<Player> Player { get; set; }
How do i add the team-modeldata to my userobject in the mongodb collection?