-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query
-
(copied to CRM)
-
Fully Compatible
https://docs.mongodb.com/ruby-driver/master/tutorials/bson-v4/#regular-expressions gives the following code as an example:
Regexp::Raw.new("^b403158")
This works when BSON is the only loaded library and when the driver is loaded, but breaks when Mongoid is also loaded:
irb(main):001:0> Regexp::Raw.new("^b403158") Traceback (most recent call last): 4: from /home/w/.rbenv/versions/2.7/bin/irb:23:in `<main>' 3: from /home/w/.rbenv/versions/2.7/bin/irb:23:in `load' 2: from /home/w/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/irb-1.2.1/exe/irb:11:in `<top (required)>' 1: from (irb):1 NoMethodError (undefined method `new' for Mongoid::Criteria::Queryable::Extensions::Regexp::Raw:Module)
It looks like Mongoid has its own Raw module that interferes:
carbon% irb -rmongoid irb(main):001:0> Regexp::Raw => Mongoid::Criteria::Queryable::Extensions::Regexp::Raw