- Attempting to update an array using dotted notation failed with a PathNotViable error (code 28) if the array is sufficiently large.
Attached is a jstest that creates an empty array, then attempts to insert 10 new elements into the array using dotted notation such as {$set: {"array.0.content": "x"}}: PathNotViable.js
The test will fail if we attempt to insert 10 elements at once. It will succeed when we try to insert fewer than that, e.g. 9 elements.
The error message printed in the console is as follows:
Cannot create field 'content' in element {: null} WriteResult({ "nMatched": 0, "nUpserted": 0, "nModified": 0, "writeError": { "code": 28, "errmsg": "Cannot create field 'content' in element {: null}" } })
This also happens when inserting the same number of elements using Pymongo.
- duplicates
-
SERVER-33687 Sort order of array indexes can determine success of an update
- Closed