Skip to content

r.uniqueId() #2063

Closed
Closed

Description

@wojons

I would like to have something that allows me to create unique ids for rethinkdb. There are a few ways it works i could just call it and it will give me just an id. if i call it from a table then it makes sure its unique with in that table. or maybe it does not? Also easy to get a large number of them if needed. If you like the rethinkdb id and want to tag your inserts with an id that you will know before hand this would be a great feature.

Activity

  1. srh commented on Mar 5, 2014

    @srh
    Contributor

    This would sometimes be nice to have. Note that r.uniqueId() (which I would rather call r.uuid()) would have to be a treated as a nondeterministic expression, the same way as r.js(...) -- you couldn't "send the query to the row" and then generate the UUID when updating a row atomically. You'd have to (assuming a straightforward implementation on the server) generate the UUID and then do the query.

    Something like thisthis:

    r.js('Math.random()').do(function(x) { return r.table('foo').update({'z': x}); })
    
  2. srh commented on Mar 5, 2014

    @srh
    Contributor

    Erm, something like that ^^^ only with r.uuid() in place of r.js(...).

    Hypothetically, a query on the server could, on a single-row update, prove that some deep r.uuid() expression is evaluated once, generate a single UUID, and then pass it along the function to be evaluated.

    Or you could use the non_atomic optarg.

    Another general option would be to pass down parameters for a deterministic UUID generator. However, this wouldn't work well with the goal of how update queries might be evaluated, unless we evaluate the updates in some unnecessarily strict well-defined order. That would be bad, or it would complicate some code that doesn't need to be made complicated.

    So I think r.uuid() or r.uniqueId(), if implemented, should be considered a nondeterministic function in the query evaluator.

  3. added this to the backlog milestone on Mar 5, 2014
  4. coffeemug commented on Mar 5, 2014

    @coffeemug
    Contributor

    Note, this is loosely related to #117.

  5. danielytics commented on Jun 12, 2014

    @danielytics

    👍 for r.uuid(). I've found myself wanting this too.

  6. coffeemug commented on Jun 12, 2014

    @coffeemug
    Contributor

    Moving to subsequent. This has been coming up a lot recently.

  7. modified the milestones: subsequent, backlog on Jun 12, 2014
  8. Tryneus commented on Jun 21, 2014

    @Tryneus
    Member

    Anyone mind if we schedule this for 1.14? It should be a pretty simple API, unless we want to complicate it.

  9. wojons commented on Jun 21, 2014

    @wojons
    ContributorAuthor

    @Tryneus 1.13.x jkjk

  10. mlucy commented on Jun 21, 2014

    @mlucy
    Member

    @Tryneus : It already looks like there are more ReQL issues in 1.14 then are actually going to make it in, but go ahead. We can trim down later.

  11. mlucy commented on Jun 21, 2014

    @mlucy
    Member

    (Also, r.uuid() seems like a better name to me.)

  12. srh commented on Jun 21, 2014

    @srh
    Contributor

    No it should obviously be r.uuid_u().

  13. Tryneus commented on Jun 21, 2014

    @Tryneus
    Member

    @mlucy, this should be one of the simplest ReQL commands, and I don't have much scheduled for 1.14 yet, so I'm just trying to take some low-hanging fruit.

  14. 24 remaining items

  15. neumino commented on Aug 15, 2014

    @neumino
    Member

    We need to write the docs for r.uuid, regenerate the reql_docs.json file before releasing.
    It may be more reasonable to remove r.uuid from 1.14.x (we could also release without the docs for r.uuid I think -- but I'm not sure @AtnNn or @larkost want to do a point release later for that)

  16. gchpaco commented on Aug 15, 2014

    @gchpaco
    Contributor

    There is a docs issue filed. s/mt/st/ change is done.

  17. gchpaco commented on Aug 15, 2014

    @gchpaco
    Contributor

    v1.14 wasn't my call, take it up with @mlucy.

  18. wojons commented on Aug 15, 2014

    @wojons
    ContributorAuthor

    is there an issuse with leaving the code in place asuming that it works and then let drivers build the support when every they get around to. part of open source is offical drivers dont have to always be the first.

  19. mlucy commented on Aug 15, 2014

    @mlucy
    Member

    We can remove r.uuid from 1.14.x if the docs absolutely positively can't make it in, but I think @wojons has been waiting on it for a while, so it would be nice if we didn't. (I realize I'm breaking the rules here because it's the 11th hour and it isn't a bugfix, but it's a very small and self-contained change that won't break anything else.)

  20. mlucy commented on Aug 15, 2014

    @mlucy
    Member

    @AtnNn -- what do you think, can this go in?

  21. wojons commented on Aug 15, 2014

    @wojons
    ContributorAuthor

    so no one gets in troble lets wait and do it in 1.15.

  22. modified the milestones: 1.14, 1.15 on Aug 15, 2014
  23. coffeemug commented on Aug 15, 2014

    @coffeemug
    Contributor

    I'd like to move this into 1.15. We could cut a corner here if absolutely necessary, but in general I think we should respect feature freezes because it's too easy for things to go wrong (even for small commands).

    @gchpaco -- would you mind reverting the commit in 1.14.x branch?

    @wojons -- the issue with getting the command in and letting the drivers handle it later is organizational. It's easy for things to slip through the cracks, for drivers to get out of sync with each other in terms of functionality, missing documentation, etc. Getting everything in at once has drawbacks, but it's generally less painful than letting the drivers lag behind.

  24. wojons commented on Aug 15, 2014

    @wojons
    ContributorAuthor

    @coffeemug

    I agree fully that is why i changed my mind last night if i have to wait another version for it then That is fine with me I still have not even had a chance to intergrate changes or http into my applicaiton so what ever is coming in 1.14 is going to be more then i can handle

  25. mlucy commented on Aug 15, 2014

    @mlucy
    Member

    No objections on my part then.

  26. gchpaco commented on Aug 15, 2014

    @gchpaco
    Contributor

    Reverted in da09b85.

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