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

Defining index breaks all search functionality ??

    • Type: Icon: Task Task
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      On my course model, newly specified:

      index(

      { stub: 1, openlibrary: 1, title: 1, description: 1 }

      )

      ran

      rake db:mongoid:create_indexes

      twice. Now...

      2.2.0 :001 > Course.where(stub:"bio_oa_ll_100").first
      => nil
      2.2.0 :003 > Course.where(stub:"bio_oa_ll_100")
      => #<Mongoid::Criteria
      selector:

      {"stub"=>"bio_oa_ll_100"}
      options: {}
      class: Course
      embedded: false>

      2.2.0 :004 > Course.where(stub:"bio_oa_ll_100").count
      => 1
      2.2 .0 :005 > Course.where(stub:"bio_oa_ll_100").first
      => nil
      2.2.0 :006 > Course.where(stub:"bio_oa_ll_100").all
      => #<Mongoid::Criteria
      selector: {"stub"=>"bio_oa_ll_100"}

      options: {}
      class: Course
      embedded: false>

      2.2.0 :007 > Course.where(stub:"bio_oa_ll_100").entries
      => [#<Course _id: 53876d686f70650c4d000000 [........]

      What on earth?

      Fixed with this:

      rake db:mongoid:remove_indexes

      Maybe amend the behavior of the first rake command (create_indexes) - should this even be possible? Wrecked my site for a few minutes.

            Assignee:
            Unassigned Unassigned
            Reporter:
            djvs djvs
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: