Fix issue with DocumentNotFoundException not handling non-scalar values correctly.