Requiring a query to determine the length of a document's array and calculate the appropriate positive integer index introduces a race condition. By allowing negative indexes (indicating distance from the end) on the $position modifier, this race condition could be avoided.
This would match Python semantics for list manipulation. An example, given the following document:
And the following update operation:
The resulting document should be:
The default insert location, the end (when $position is omitted or exceeds the length of the array), is unaffected.
Thank you for your consideration!