Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-331

Sort in collection#map_reduce isn't work properly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 1.4.0
    • Affects Version/s: 1.3.1
    • Component/s: None
    • Environment:
      Ruby 1.9.2

      From description for #map_reduce method (https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/collection.rb#L581):

      @option opts [Array] :sort ([]) an array of [key, direction] pairs to sort by. Direction should
      be specified as Mongo::ASCENDING (or :ascending / :asc) or Mongo::DESCENDING (or :descending / :desc)

      Actual is needed to do Mongo::Support.format_order_clause for this option.

      I.e {:sort => [[:position, :asc]]} raises error, but {:sort => Mongo::Support.format_order_clause([[:position, :asc]])} executes appropriate map/reduce command.

            Assignee:
            kbanker Kyle Banker
            Reporter:
            mik-die Mikhail Dieterle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: