#1173·mikro-orm

[Feature]: Embedded partial updates

Author: dvlalexCreated Dec 7, 2020Updated Jan 13, 2025
Labelsenhancement

Is your feature request related to a problem? Please describe. I'm not sure if this is a feature of a bug, but I've noticed when updating an object embeddable, the queries resets the entire thing.

Describe the solution you'd like Since using object embedded properties is allowed on mongo/mysql/postgresql only, they all have the option to partially update an object/json type. Might be better for larger embeddables to instead do the updates on the changed properties only.

Additional context This is how a query looks for an embeddable with object: false [query] db.getCollection('profile').updateMany({ _id: ObjectId('5fcdf987008a1d1fa3dc6c7e') }, { '$set': { cat_name: 'new name' } }, { session: undefined }); [took 5 ms]

And this is for an object: true [query] db.getCollection('profile').updateMany({ _id: ObjectId('5fcdf9b09b9b60205fd56db7') }, { '$set': { cat: { type: 0, name: 'new name', canMeow: true } } }, { session: undefined }); [took 3 ms]