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

Fatal error with Mongo 2.5.0.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0, 6.3.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Linux

      This line:
      author = Mongoid::QueryCache.cache

      { Authors.find(news.author_id) }

      causes error: undefined method `select_server' for nil:NilClass

      backtrace:

      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/query_cache.rb:225:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual/mongo.rb:132:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual.rb:20:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/criteria/findable.rb:108:in `entries'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/criteria/findable.rb:108:in `from_database'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/criteria/findable.rb:76:in `multiple_from_db'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/criteria/findable.rb:20:in `execute_or_raise'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/criteria/findable.rb:41:in `find'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/findable.rb:94:in `find'
      app/views/svetovanje/novice.html.erb:15:in `block (3 levels) in _app_views_svetovanjenovice_html_erb__2280375005956261036_69126640'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/query_cache.rb:69:in `cache'
      app/views/svetovanje/novice.html.erb:15:in `block (2 levels) in _app_views_svetovanjenovice_html_erb__2280375005956261036_69126640'
      vendor/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/capture_helper.rb:39:in `block in capture'
      vendor/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/capture_helper.rb:203:in `with_output_buffer'
      vendor/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/capture_helper.rb:39:in `capture'
      vendor/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/tag_helper.rb:272:in `content_tag'
      vendor/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/url_helper.rb:198:in `link_to'
      app/views/svetovanje/novice.html.erb:12:in `block in _app_views_svetovanjenovice_html_erb__2280375005956261036_69126640'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual/mongo.rb:696:in `yield_document'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual/mongo.rb:133:in `block in each'
      vendor/ruby/2.4.0/gems/mongo-2.5.0/lib/mongo/collection/view/iterable.rb:46:in `block in each'
      vendor/ruby/2.4.0/gems/mongo-2.5.0/lib/mongo/cursor.rb:117:in `block in each'
      vendor/ruby/2.4.0/gems/mongo-2.5.0/lib/mongo/cursor.rb:117:in `each'
      vendor/ruby/2.4.0/gems/mongo-2.5.0/lib/mongo/cursor.rb:117:in `each'
      vendor/ruby/2.4.0/gems/mongo-2.5.0/lib/mongo/collection/view/iterable.rb:45:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/query_cache.rb:222:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual/mongo.rb:132:in `each'
      vendor/ruby/2.4.0/gems/mongoid-6.2.1/lib/mongoid/contextual.rb:20:in `each'

      etc .....

      It happens only with mongo 2.5.0. driver. Reverting to mongo 2.4.3. version makes problem disapear.

      by
      Damjan Rems

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            d_rems@yahoo.com Damjan Rems
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: