You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This named scope produces a different result on the 4.3 version of the engine: scope :by_id_or_slug, ->(id_or_slug) { all.or({ _id: id_or_slug }, { slug: id_or_slug }) }
Test from the Rails console: irb(main):028:0> site.sections.by_id_or_slug("hero").size=> 47
The previous engine versions produce a selector like this: 2.5.1 :010 > silte.sections.by_id_or_slug("image_bg").size => 1 2.5.1 :011 > silte.sections.by_id_or_slug("image_bg").selector => {"site_id"=>BSON::ObjectId('5c82be9824d35f685b3b632f'), "$or"=>[{"_id"=>"image_bg"}, {"slug"=>"image_bg"}]}
This is the one place I found the issue. Probably there are other places.
Right now the only solution I see is to downgrade back to 4.1.1 until this is patched.
The text was updated successfully, but these errors were encountered:
After upgrading to the latest engine version 4.3 we are having issues pushing some resources from wagon to engine.
I traced the issue to some breaking changes in how Mongoid handles operator combinations since 7.1:
https://www.mongodb.com/docs/mongoid/7.5/reference/queries/#operator-combinations
This named scope produces a different result on the 4.3 version of the engine:
scope :by_id_or_slug, ->(id_or_slug) { all.or({ _id: id_or_slug }, { slug: id_or_slug }) }
Test from the Rails console:
irb(main):028:0> site.sections.by_id_or_slug("hero").size=> 47
irb(main):029:0> site.sections.where(slug: "hero").or(_id: "hero").size=> 1
irb(main):030:0> site.sections.by_id_or_slug("hero").selector=> {"site_id"=>BSON::ObjectId('5ebfc39e232fb906a3dfc34b'), "$or"=>[{"site_id"=>BSON::ObjectId('5ebfc39e232fb906a3dfc34b')}, {"_id"=>"hero"}, {"slug"=>"hero"}]}
irb(main):031:0> site.sections.where(slug: "hero").or(_id: "hero").selector=> {"$or"=>[{"site_id"=>BSON::ObjectId('5ebfc39e232fb906a3dfc34b'), "slug"=>"hero"}, {"_id"=>"hero"}]}
The previous engine versions produce a selector like this:
2.5.1 :010 > silte.sections.by_id_or_slug("image_bg").size => 1
2.5.1 :011 > silte.sections.by_id_or_slug("image_bg").selector => {"site_id"=>BSON::ObjectId('5c82be9824d35f685b3b632f'), "$or"=>[{"_id"=>"image_bg"}, {"slug"=>"image_bg"}]}
This is the one place I found the issue. Probably there are other places.
Right now the only solution I see is to downgrade back to 4.1.1 until this is patched.
The text was updated successfully, but these errors were encountered: