Failing query with arrayElemAt

Thanks so much for your script! You are right, I found two examples of records that didn’t follow the format: TransactionStatus contained a single object rather than an array. Problem fixed; thanks for your help!