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

Feature request: add ability to prevent modifying certain value in unflatten #160

Open
jamauro opened this issue Jan 10, 2023 · 2 comments

Comments

@jamauro
Copy link

jamauro commented Jan 10, 2023

I have a use case where I'd like to prevent the target's value from being modified in unflatten. There's probably a number of ways to approach it but here's what I was thinking:

// prevent modifying any object with a value of 'testValue'
unflatten(obj, {filter: {value: 2}})

// prevent modifying any object with a key of 'thing'
unflatten(obj, {filter: {key: 'thing'}})

// prevent modifying the object {thing: 2}
unflatten(obj, {filter: {key: 'thing', value: 2}})
@jonshipman
Copy link

Common way to reproduce, if you use mongodb and have a bunch of generated ObjectIds as values, they will be stripped out into new objects, e.g. {}

@mdwekat
Copy link

mdwekat commented Jan 1, 2024

happened to me when unflatten object with mongoId the ids will end up as {}

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

No branches or pull requests

3 participants