Reputation: 30346
I want to add a new player to a basketball team document in DocumentDb. Is it an INSERT or an UPDATE?
Say, the team document looks like this:
{
id: 123,
name: "Small Town Bobcats",
players: [
{ id: 456, name: "John Smith", position: "Guard" },
{ id: 567, name: "James Green", position: "Center" }
]
}
Should this be a simple operation of replacing existing players with a new array that includes the new player's data? If not, what is the right approach to adding a new player to this team?
Upvotes: 1
Views: 409
Reputation: 9533
There is no update in place in DocumentDB. You need to replace the document with a completely new one containing your updated player list.
Upvotes: 4