The document migration for deviceconnect is broken and has never worked if a tenant has more than 255 devices. There is a missing BulkWrite inside the inner migration loop. Fix the migration and create a new patch migration that handles potential broken database collections.
Update: The current migration only results in a functional loss for the open-source version (because of duplicate key on device id in the devices collection) - this issue is partially resolved by multi-tenancy mode doing just-in-time provisioning of devices. However, the migration results in loss of data if the respective size of the collection is larger than 255 documents.