has_one association uses $in

XMLWordPrintableJSON

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

      class Human
      has_one :brain
      end

      class Brain
      belongs_to :human
      end

      human.brain #=> app['brains'].find({"user_id"=>{"$in"=>[BSON::ObjectId('4e1ff77971e2f4000100001e')]}})

      This seems a little inefficient (especially with indexes). I'd have presumed it would have generated a query like:

      app['brains'].find(

      {"user_id"=>BSON::ObjectId('4e1ff77971e2f4000100001e')}

      )

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

                Created:
                Updated:
                Resolved: