Skip to content

Support nested attribute access in orderBy #1120

Closed

Description

@coffeemug
table.orderBy(r.row('i')('j'), r.desc(r.row('k')('l')('m')))

Naturally people should also be able to pass lambdas directly instead of r.row.

Activity

  1. jdoliner commented on Jul 3, 2013

    @jdoliner
    Contributor

    You can also use an arbitrary function as an argument to order_by.

  2. jdoliner commented on Jul 8, 2013

    @jdoliner
    Contributor

    Working on this.

  3. mlucy commented on Jul 9, 2013

    @mlucy
    Member

    Alright, this is settled. I'm stealing the pathpec proposal from #1094 into this issue.

    I talked to Joe about this earlier, and here's what we settled on:

    • orderby should take arbitrarily many functions and pathspecs
    • We'll turn the result of asc and desc into a new psuedo-type so that it can be included in arrays or objects. These objects will be of the form:
    r.desc(1) =>
    {:__reql_type__ => 'ordering',
     :direction => 'desc',
     :data => 1}
    
  4. jdoliner commented on Jul 9, 2013

    @jdoliner
    Contributor

    Wait when did we talk about orderby taking pathspecs? The whole point of this proposal is that orderby shouldn't take pathspecs.

  5. coffeemug commented on Jul 9, 2013

    @coffeemug
    ContributorAuthor

    Just talked to @mlucy in person, I think he misunderstood what we decided to do here. orderby won't, in fact, take pathspecs.

  6. mlucy commented on Jul 9, 2013

    @mlucy
    Member

    I misunderstood the previous conversation; I thought we were discussing making the result of asc and desc a pseudotype because we wanted to support pathspecs. Ignore the pathspec part.

  7. jdoliner commented on Jul 9, 2013

    @jdoliner
    Contributor

    Also turning r.desc into a pseudo type doesn't work because it needs to be able to have functions as the data field which doesn't work with our type system right now. This is actually kind of an annoyance.

  8. mlucy commented on Jul 10, 2013

    @mlucy
    Member

    We worked around this.

  9. coffeemug commented on Jul 10, 2013

    @coffeemug
    ContributorAuthor

    We should also apply this notation to join commands. Specifically:

    r.table("foo").eq_join( r.row['nested']['field'], r.table("bar") )
  10. jdoliner commented on Jul 16, 2013

    @jdoliner
    Contributor

    This is in review 742.

  11. jdoliner commented on Jul 18, 2013

    @jdoliner
    Contributor

    In next as of ca57442. Ships 1.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions