Spring Data MongoDB multiple Push

Hi there, I have a little question about multiple Push’es in array insertions. Normally when we insert multiple elements into an array, we use:

new Update().push("key").each(Object[] values);

However, sometimes I need to leave an Update instance open to gather operations necessitated across several segments of code, and make the update cumulatively at the end to minimize the operation overhead with the MongoDB server, just like:

Update update = new Update();
if (...) {
  //SOME STUFF
  update.push("array", "newElement1");
}
if (...) {
  //SOME STUFF
  update.pullAll("array", arrayOfElementsToRemove);
}
if (...) {
  //SOME STUFF
  update.set("key", "anotherValue");
}
if (...) {
  //SOME STUFF
  update.push("array", "newElement2");
}
mongoTemplate.updateFirst(query, update, class, collection);

So my question is, if I apply the same command more than once to an Update instance, like the pushes of “newElement1” and “newElement2” above, what would its real behavior be? Is it:

  1. The pushes will be compounded like a pipeline, “newElement1” will be pushed and then it’s “newElement2”, or:
  2. The last Push command will override all the previous push’es and only “newElement2” will be pushed.

As it seems there’s an implication that one command can only be applied once, but I found no open Spring Data documents explicitly mandating this behavior. Any replies are warmly appreciated, thanks!