You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider JSON-PATCH RFC6902 for changes() stream. #3575
Seems weird to define a custom format for the changes feed when there is a standard around. May be a bit complex though for clients to use though, but if its kept to simple, remove/add/replace ops it wouldn't be so bad.
That appears to be a standard for applying a patch to a single document. The documents sent by changes are instead "patches" to a set of documents, i.e. they only say to add or remove a particular document from the set rather than having to specify a path into a sub-field to be changed. It would be cool to add support for JSON-PATCH when an element of the set has only changed by a small amount, though. Thanks for the suggestion!
@jeregrine : maybe I don't understand what you mean. Let's say you've run r.table('test').orderby(index: 'score').limit(10).changes(), and a new player enters the top 10; what would you expect to see? (The current format would be {old_val: player_leaving_top_10, new_val: player_entering_top_10}.)
I could imagine us adapting the JSON-PATCH syntax to work for sets rather than single documents, but I'm not sure it would be better than what we have.
jsonpatch would make a lot of sense for point changefeeds.
If users write apps or use libraries that support jsonpatch, it might be halpful to add .diff and .patch commands that could be used for things like .replace(lambda row: row.patch(patch)).
However I don't get the impression that jsonpatch support and use is very widespread. Please correct me if I am wrong.
It does provide significant performance for size, but it obviously depends on the JSON and number of changes happening. You can test level of improvements on the base of an API here : streamdata.io. Put an API into the field and a graph will give you the quantity of data saved.
Activity
mlucy commentedon Jan 15, 2015
That appears to be a standard for applying a patch to a single document. The documents sent by
changesare instead "patches" to a set of documents, i.e. they only say to add or remove a particular document from the set rather than having to specify a path into a sub-field to be changed. It would be cool to add support for JSON-PATCH when an element of the set has only changed by a small amount, though. Thanks for the suggestion!jeregrine commentedon Jan 15, 2015
@mlucy I was thinking it would be a good fit for the query.changes() format in the next release.
mlucy commentedon Jan 15, 2015
@jeregrine : maybe I don't understand what you mean. Let's say you've run
r.table('test').orderby(index: 'score').limit(10).changes(), and a new player enters the top 10; what would you expect to see? (The current format would be{old_val: player_leaving_top_10, new_val: player_entering_top_10}.)I could imagine us adapting the JSON-PATCH syntax to work for sets rather than single documents, but I'm not sure it would be better than what we have.
AtnNn commentedon Jan 15, 2015
jsonpatch would make a lot of sense for point changefeeds.
If users write apps or use libraries that support jsonpatch, it might be halpful to add
.diffand.patchcommands that could be used for things like.replace(lambda row: row.patch(patch)).However I don't get the impression that jsonpatch support and use is very widespread. Please correct me if I am wrong.
jeregrine commentedon Jan 15, 2015
@AtnNn there is some neat stuff happening with orbit.js https://github.com/orbitjs/orbit.js/tree/master around syncing js clients.
jasonkuhrt commentedon May 23, 2015
Without being familiar with
JSON-PATCH RFC6902specifically I would like to see diffs modeled better in rethinkDB. For example instead ofsomething that allows me to know:
idchanged? (In this casefoodbar2)code_namefield)I would like to go deeper into the RFC and learn about it.
Wouldn't supporting diffs provide potentially significant performance benefits for size of data-over-the-wire?
nicolasbabel commentedon Jun 19, 2015
It does provide significant performance for size, but it obviously depends on the JSON and number of changes happening. You can test level of improvements on the base of an API here : streamdata.io. Put an API into the field and a graph will give you the quantity of data saved.
danielmewes commentedon Aug 18, 2015
Closing as a duplicate of the newer #4707, which is slightly more precise.