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

Mongoid 3.1.0 not finding records even though records exist?

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

      MongoDB shell version: 2.0.4
      > show collections
      find_by_models
      system.indexes
      
      > db.find_by_models.find({ f1: 1 })
      { "_id": ObjectId("511bb556bd35bb48d3000001"), "f1": 1, "f2": 2, "f3": 3 }
      { "_id": ObjectId("511bb556bd35bb48d3000002"), "f1": 1, "f2": 2, "f3": 3 }
      { "_id": ObjectId("511bb556bd35bb48d3000003"), "f1": 1, "f2": 2, "f3": 3 }
      { "_id": ObjectId("511bb556bd35bb48d3000004"), "f1": 1 }
      
      [1] pry > clean_model.create!(f1: 1)
      # => #<
        Lwhoxemrvrr
        _id: 511bb556bd35bb48d3000004,
        f1: 1,
        f2: nil,
        f3: nil,
        _type: nil
      >
      
      [2] pry > clean_model.find_by(f1: 1)
      # => nil
      
      [3] pry > clean_model.where(f1: 1)
      # => #<
        Mongoid::Criteria
        selector: {"f1"=>1}
        options:  {}
        class:    Lwhoxemrvrr
        embedded: false
      >
      
      [4] pry > clean_model.where(f1: 1).to_a
      # => []
      

      If the final goal of 3.1 is to push out my version of Mongo the question is why? It's the version in Ubuntu LTS. If it's not what could be going wrong because my specs suddenly broke when 3.1 was released and I ran a spec against it.

            Assignee:
            durran Durran Jordan
            Reporter:
            envygeeks envygeeks
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: