O'Reilly logo
  • Ravisankar Mariyappagari thinks this is interesting:

In many cases, though, we don’t know what index of the array to modify without querying for the document first and examining it. To get around this, MongoDB has a positional operator, $, that figures out which element of the array the query document matched and updates that element. For example, if we have a user named John who updates his name to Jim, we can replace it in the comments by using the positional operator:

From

Cover of MongoDB: The Definitive Guide, 3rd Edition

Note

Repetitive