Lets say we have a document like this
{
"_id" : "1234",
"Data" : {
"Name" : "Pythagoras",
"Like" : "Math"
}
And we changed over mind and want to push more things to Data->Like so it looks like;
{
"_id" : "1234",
"Data" : {
"Name" : "Pythagoras",
"Like" : ["Math", "Science"]
}
All the atomic operators like $push, $pushAll and $addToSet works just when Data->Like already is an array.
I´m using the php-driver. In this example there is no meaning to not set the Data->Like to an array at the beginning but it does not work like that in my code ;(
Hope you can help me and sorry for my bad English ;) Thanks!