Closed emilbayes closed 9 years ago
Hey @emilbayes, that sounds like a cool project!
Is /arr/- reference used?
jiff.diff
will not generate patches containing the /arr/-
syntax. However, jiff.patch
will handle patches containing that syntax.
Are only add, remove, replace and test used?
Yes, that is correct. jiff.diff
will not generate move
or copy
.
Another thing that you may need to know if that jiff.diff
currently produces "safe" patches. Each operation is preceded by a test
that verifies its precondition. That's not a requirement of the RFC, but it is the only way to produce patches that are invertible. In general, I think it's a good thing, but it does mean that patches are larger. If that's a problem for your use case, let me know. I think we could consider adding an option to disable the extra test
ops.
I see the extra test
ops as a strength (at least in theory). My intention is to use these to do the "select" part of the query, and do "update" using the modifying operations. Thanks for the feedback!
Cool. happy to help.
I'm developing a MongoDB adapter for JSON Patches and am using
jiff
to do diffs. Because some operations are not possible with the underlying query language I was wondering if I might make do with just a subset of the operations defined in the RFC.So I have a couple of questions, that I think I've got the answers to from reading the source, but I'd love if you could confirm:
/arr/-
reference used? I don't seem to find it in thediff
function.add
,remove
,replace
andtest
used? This seems to be my conclusion from reading throughdiff
,appendChanges
,appendObjectChanges
,appendArrayChanges
etc. and also form some informal tests