-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 5.1.3
-
Component/s: None
-
None
class Movie include Mongoid::Document has_many :ratings, as: :ratable end class Rating include Mongoid::Document belongs_to :ratable, polymorphic: true end
When querying on a polymorphic foreign key string:
Rating.where(ratable_id: "56cf07ccf1286e1286530b03") => #<Mongoid::Criteria selector: {"ratable_id"=>"56cf07ccf1286e1286530b03"} options: {} class: Rating embedded: false>
It expected:
Rating.where(ratable_id: "56cf07ccf1286e1286530b03") => #<Mongoid::Criteria selector: {"ratable_id"=>BSON::ObjectId('56cf07ccf1286e1286530b03')} options: {} class: Rating embedded: false>
- is duplicated by
-
MONGOID-4367 Querying on IDs passed as Strings instead of BSON::ObjectId instances returns 0 results
- Closed