-
Notifications
You must be signed in to change notification settings - Fork 64
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
oi replaces even if exists #16
Comments
The problem I have here it that I would like to be able to insert an element into an array without knowing if the array exists or not, and if it doesn't exists it should be created: Which I thought would be possible with the following: [{
p: ['tags'],
oi: [],
}, {
p: ['tags', 0],
li: 'archived',
}], However, this will always result in |
As a side-note, this is also a huge problem with inversion. It's currently possible to have: {
"tags": ["archived"]
} and then perform this op on it: [
{
"p": ["tags"],
"oi": []
}
] ...resulting in this document: {
"tags": []
} Then when you try to invert the previous operation, the op doesn't know what was originally there when it replaced it, so it just deletes the field, resulting in: {} ...which is not what I had before. In my opinion, in the case where a path is being overwritten, |
Aha, I've just seen that my issue is probably addressed in this PR: #19 |
For
{p:PATH, oi:NEWVALUE}
The documentation says:
However, if they key exists it currently will overwrite it...
Not sure what the correct behaviour is?
The text was updated successfully, but these errors were encountered: