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

merge doesn't work on deep paths #12

Open
msaffitz opened this issue Jan 24, 2012 · 1 comment
Open

merge doesn't work on deep paths #12

msaffitz opened this issue Jan 24, 2012 · 1 comment

Comments

@msaffitz
Copy link

First, thanks for the really useful library.

The merge utility doesn't appear to work on deeply nested paths. For example, if I have a schema:

name:
    first: String
    last: String

then the first and last properties aren't merged into the parent object. It looks like this is because the value is retrieved on the source document by array getter (e.g. doc[name]), and when name is "name.first" the retrieval fails.

(I think this is relatively straightforward to fix, but I also believe you need to code for edge cases around circular references, which if is the case complicates things some. it's possible the code from node.extend could be leveraged?...)

@tblobaum
Copy link
Owner

I'll look into this. Merge has a few edge cases that will probably never work, like arrays and embedded docs. This can work though, it's going to be similar to a deep extend or clone

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

2 participants