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

Using a String in a query instead of a Moped::BSON::ObjectId

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

      This was unexpected behavior:

      irb(main):019:0> Transaction.where(:'account_changes.account_id' => a1.id).count
      => 11
      irb(main):020:0> Transaction.where(:'account_changes.account_id' => a1.id.to_s).count
      => 0
      irb(main):021:0>
      

      But they produce the same queries on the moped side:

        MOPED: 127.0.0.1:27017 COMMAND      database=myapp_development command={:count=>"transactions", :query=>{"account_changes.account_id"=>"50627427f8182b3ec1000002"}} (0.9530ms)
        MOPED: 127.0.0.1:27017 COMMAND      database=myapp_development command={:count=>"transactions", :query=>{"account_changes.account_id"=>"50627427f8182b3ec1000002"}} (0.9091ms)
      

      Bug? This is with Mongoid 3.0.6. Thanks durran!

            Assignee:
            Unassigned Unassigned
            Reporter:
            barmstrong Brian Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: