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

Index direction ignored in index_specifications

    • Type: Icon: Task Task
    • Resolution: Done
    • 4.0.0 final
    • Affects Version/s: None
    • Component/s: None

       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.

            Assignee:
            arthurnn Arthur Nogueira Neves
            Reporter:
            dblock Daniel Doubrovkine
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: