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

comparison of Fixnum with nil failed

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Been Trying to delete this user but keeps bugging out on me. Can't figure out why.

      Is there a way around this problem? If more information need I can provide.

      # If object exists then compare the two, otherwise return false
      #
      # @exampleDetermine if we can compare.
      #   matcher.determine("test", "$in")
      #
      # @param[ Object ] value The value to compare with.
      # @param[ Symbol, String ] operator The comparison operation.
      #
      # @return [ true, false ] The comparison or false.
      #
      # @since1.0.0
        def determine(value, operator)
          puts value
          puts operator
          attribute.__array__.any? {|attr|
            attr ? attr.send(operator, first(value)) : false
          }
        end
      
      

      Here is the out put I get with the code I I am using above

      > id = '54909ce4752d71293e320900'
      > user = User.where(id: id).first
      2.0.0 :010 > user.delete
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>1}
      >
      {"$gt"=>nil}
      >
      {"$gt"=>nil}
      >
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/default.rb:69:in `>'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/default.rb:69:in `block in determine'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/default.rb:68:in `each'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/default.rb:68:in `any?'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/default.rb:68:in `determine'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable/gt.rb:17:in `matches?'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable.rb:58:in `block (2 levels) in matches?'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable.rb:57:in `each'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable.rb:57:in `block in matches?'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable.rb:55:in `each_pair'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/matchable.rb:55:in `matches?'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual/memory.rb:152:in `block in initialize'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual/memory.rb:149:in `select'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual/memory.rb:149:in `initialize'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual.rb:53:in `new'
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual.rb:53:in `create_context'
      ... 25 levels...
      from /path/toshared/bundle/ruby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/persistable/deletable.rb:23:in `delete'
      from (irb):10
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/console.rb:90:in `start'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/console.rb:9:in `start'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:69:in `console'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:43:in `require'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:43:in `block in exec_app_rails'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:32:in `loop'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/lib/rails/cli.rb:5:in `<top (required)>'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/bin/rails:9:in `require'
      from /path/toshared/bundle/ruby/2.0.0/gems/railties-4.1.6/bin/rails:9:in `<top (required)>'
      from /path/toshared/bundle/ruby/2.0.0/bin/rails:23:in `load'
      from /path/toshared/bundle/ruby/2.0.0/bin/rails:23:in `<main>'2.0.0 :011 > exit
      

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            newdark newdark
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: