Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[core]: partially update embedded object properties #1181

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dvlalex
Copy link
Contributor

@dvlalex dvlalex commented Dec 8, 2020

I've added in some logic for when an embedded property is set as { object: true }.

Currently an old query that was:
[query] db.getCollection('user').updateMany({ _id: ObjectId('5fcf95d54f6a9653930f3c8b') }, { '$set': { address1_city: 'new city', address4: { street: null, postalCode: null, city: 'new city 4', country: null } } }, { session: undefined }); [took 2 ms]

now, looks like:
[query] db.getCollection('user').updateMany({ _id: ObjectId('5fcf96cd2c05055470c9edff') }, { '$set': { address1_city: 'new city', address4: { city: 'new city 4' } } }, { session: undefined }); [took 2 ms]

So the changes are computed properly for object types, but I'm not sure where to go from now. I'd have to tap into each specific driver and make sure that for embedded objects on update it doesnt replace the value. Any pointers / ideas?

Is this a good place to do so for mongo?

private renameFields<T>(entityName: string, data: T, where = false): T {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant