Details

    • Backport:
      No
    • # Replies:
      5
    • Last comment by Customer:
      true

      Description

      Originally posted

      https://groups.google.com/d/topic/mongodb-user/PL_g1RCmPsI/discussion

      It would be very useful to be able to extract the indexed position of a document from a group statement, or a sort. e.g. consider the use case of building up a leader board / league table.

      Workaround suggestions welcome in the meantime.

        Activity

        Hide
        Sam Halliday
        added a comment -

        Hi Stephen,

        Not sure what the "debugging with submitter" status means. I consider MR / JS console approaches to be (hacky) workarounds. I'd still like to see a feature to insert the position of a document (in an aggregation) into the document through a group or project.

        Regards,
        Sam

        Show
        Sam Halliday
        added a comment - Hi Stephen, Not sure what the "debugging with submitter" status means. I consider MR / JS console approaches to be (hacky) workarounds. I'd still like to see a feature to insert the position of a document (in an aggregation) into the document through a group or project. Regards, Sam
        Hide
        Eliot Horowitz
        added a comment -

        This could be interesting, but also problematic.
        If that projection is the last step in a pipeline, then I'm not sure how much easier it is since you have the position in the client.

        This could be very useful if the projection is not the last step.
        i.e. do a sort, and the position, then re-sort based on something else.
        Then you can see people sorted by name, with their position.

        The problem is that requires consistency from all shards.
        So it would be a scaling bottleneck.

        Show
        Eliot Horowitz
        added a comment - This could be interesting, but also problematic. If that projection is the last step in a pipeline, then I'm not sure how much easier it is since you have the position in the client. This could be very useful if the projection is not the last step. i.e. do a sort, and the position, then re-sort based on something else. Then you can see people sorted by name, with their position. The problem is that requires consistency from all shards. So it would be a scaling bottleneck.
        Hide
        Sam Halliday
        added a comment -

        Eliot, exactly this is not the last step in a pipeline for me (there are further constraints and limits, etc).

        I don't shard this collection, so that is not a concern. Happy for this to be a no-shards-allowed function.

        Show
        Sam Halliday
        added a comment - Eliot, exactly this is not the last step in a pipeline for me (there are further constraints and limits, etc). I don't shard this collection, so that is not a concern. Happy for this to be a no-shards-allowed function.
        Hide
        Eliot Horowitz
        added a comment -

        We try not to do functions that only work non-sharded, as then people get quite surprised when they loose that functionality.

        Will see if there is a way to implement this efficiently sharded.

        Show
        Eliot Horowitz
        added a comment - We try not to do functions that only work non-sharded, as then people get quite surprised when they loose that functionality. Will see if there is a way to implement this efficiently sharded.
        Hide
        Asya Kamsky
        added a comment -

        if SERVER-4588 was implemented that might be a workaround for this. Since you can basically group on a constant and build up an array with all documents (or at least known fields of interest) and then unwind with index if SERVER-4588 exists.

        Show
        Asya Kamsky
        added a comment - if SERVER-4588 was implemented that might be a workaround for this. Since you can basically group on a constant and build up an array with all documents (or at least known fields of interest) and then unwind with index if SERVER-4588 exists.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since reply:
              48 weeks, 3 days ago
              Date of 1st Reply: