On 27.08.2012 17:47, lwb wrote:
> Hi Jan,
>
> First, to insert the array [item3, 0,0] into your larger array, you want
> to use the $pushAll rather than $push -- this will append the whole
> [item3, 0, 0] array into your array.
>
> Currently, there is no $insert operator that will allow you to insert an
> object into a specific place in your array. You can file a ticket
> requesting this feature at
jira.mongodb.org . You can create an account
> on that page, and then can create a new issue using the button in the
> top right corner.
>
Hello Louisa,
I created a ticket in Jira at
https://jira.mongodb.org/browse/SERVER-6873 with an example included.
As for $pushAll - I don't think that's the desired behavior as $push.
Referring to
http://www.mongodb.org/display/DOCS/Updating#Updating-%24pushAll
"every" item of the Array would been pushed into the container array
instead of just appending the whole Array into the container (in my case
the array item) to the container array itself.
The difference would be:
$pushAll [ [Item1, 0,0], [Item2, 0,0], Item3, 0,0 ] <- and this would be
wrong for my case, the data should look like:
[ [Item1, 0,0], [Item2, 0,0], [Item3, 0,0] ] (notice the extra [] here)
- its encapsulated as an additional array inside the container array
But thank you still for answering, would be great if you could implement
this feature and roll it into the (python) and other drivers and the
core! :)
Regards
Jan