Hello,
Suppose I have a document that looks like this:
{
"key": "value"
"colors: ['red', 'yellow', 'blue']
}
What I would like to do is write a simple insert or update statement that will allow me to add the element "green" to the colors array at position 2. The resulting document would look like this:
{
"key": "value"
"colors: ['red', 'yellow', 'green', 'blue']
}
A further constraint is that the actual data in the array is very larger, so I do not want to read the entire array out, add an element in code, and then write it back to the parent document. I would really like to be able insert the element into the existing array in the database. I took a look at the "UPDATE ADD" syntax but was unable to figure this out.
Thanks!
~Michael