OpenHausIO / backend

HTTP API for the OpenHaus SmartHome/IoT solution
https://docs.open-haus.io
6 stars 2 forks source link

`/system/backup/import` breaks database updates #506

Closed mStirner closed 1 month ago

mStirner commented 1 month ago

The restore override the ObjectId to a string. This breaks everything. Update items (via HTTP or direct inside plugins via .update) does not work then anymore

mStirner commented 1 month ago

https://github.com/OpenHausIO/backend/blob/dbf499ec68eb4ab7d4204ab21efea51133fe824c/routes/router.system.backup.js#L185

Cast item ._id to real ObjectId:

                    let documents = JSON.parse(Buffer.concat(chunks).toString()).map((item) => {
                        item._id = new ObjectId(item._id);
                        return item;
                    });