Skip to content

Consider JSON-PATCH RFC6902 for changes() stream. #3575

Closed

Description

@jeregrine

https://tools.ietf.org/html/rfc6902

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.

Activity

  1. added this to the subsequent milestone on Jan 15, 2015
  2. mlucy commented on Jan 15, 2015

    @mlucy
    Member

    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!

  3. jeregrine commented on Jan 15, 2015

    @jeregrine
    Author

    @mlucy I was thinking it would be a good fit for the query.changes() format in the next release.

  4. mlucy commented on Jan 15, 2015

    @mlucy
    Member

    @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.

  5. AtnNn commented on Jan 15, 2015

    @AtnNn
    Member

    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.

  6. jeregrine commented on Jan 15, 2015

    @jeregrine
    Author
  7. jasonkuhrt commented on May 23, 2015

    @jasonkuhrt

    Without being familiar with JSON-PATCH RFC6902 specifically I would like to see diffs modeled better in rethinkDB. For example instead of

    {
    "new_val":{"code_name":"monkey","id":"foobar2","linked_firmware_version":"1.5.150213z"},
    "old_val":{"code_name":"bamboo","id":"foobar2","linked_firmware_version":"1.5.150213z"}
    }
    

    something that allows me to know:

    • What document id changed? (In this case foodbar2)
    • What fields changed? (In this case just code_name field)
    • What fields were removed? (In this case none)
    • What fields were added? (In this case none)

    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?

  8. nicolasbabel commented on Jun 19, 2015

    @nicolasbabel

    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.

  9. danielmewes commented on Aug 18, 2015

    @danielmewes
    Member

    Closing as a duplicate of the newer #4707, which is slightly more precise.

  10. modified the milestones: duplicate, backlog on Aug 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions