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

keys must be strings or symbols

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      class Series
      include Mongoid::Document
      field :started_on, :type => DateTime
      scope :aggregatable, lambda

      {where(:started_on.gte => 5.days.ago)}

      end

      If I am using bson_ext, I get the infamous "keys must be strings or symbols" error. I have updated my Gem file to point to this github repo and it still persists. This exact same issue is why I gave up on mongomapper and switched to mongoid. Stack trace:

      ruby-1.8.7-p249 > Series.aggregatable.execute.to_a
      TypeError: keys must be strings or symbols
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/bson-1.0.3/lib/../lib/bson/bson_c.rb:24:in `serialize'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/bson-1.0.3/lib/../lib/bson/bson_c.rb:24:in `serialize'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:364:in `construct_query_message'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:346:in `send_initial_query'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:324:in `refill_via_get_more'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:319:in `num_remaining'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:92:in `has_next?'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/gems/mongo-1.0.3/lib/../lib/mongo/cursor.rb:205:in `to_a'
      from /home/michael/.rvm/gems/ruby-1.8.7-p249/bundler/gems/mongoid-af80db8e53d021c0543aa7940052c21b79dfde86-master/lib/mongoid/cursor.rb:79:in `to_a'

            Assignee:
            Unassigned Unassigned
            Reporter:
            MichaelXavier Michael Xavier [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: