Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3348

Index direction ignored in index_specifications

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0.0 final
    • Component/s: None
    • Labels:

      Description

       ruby
      require 'mongoid'
       
      class Foo
        include Mongoid::Document
       
        field :x
        index(x: -1)
        index(x: 1)
      end
       
      Foo.index_specifications.each do |spec|
        p spec
      end
      

      This only yields a single index specification:

      [#<Mongoid::Indexable::Specification:0x007fdb8f45c4b0 @klass=Foo, @key={:x=>-1}, @options={}>] 
      

      This is definitely a change from 3.x, but I wonder whether it's by design? I am not clear whether having an index in both directions actually does anything in MongoDB, so if it's not a regression it should at least be documented.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: