How would I go about atomically adding a value to the beginning of an array in mongo?
Thanks for any guidance.
You can't do it directly as per this ticket.
Your only option is for now is to fetch the array, put the element at the beginning and put it in mongo again.
someArray.unshift(someValue);
E.g.
> x = [1,2,3]
[1, 2, 3]
> x.unshift(0)
4
> x
[0, 1, 2, 3]