Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54588

Query on system.profile() failing when certain regex is recorded

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.4
    • Component/s: Querying
    • None
    • Query Execution
    • ALL
    • Hide

       

      1. Using Ruby but it also works on C# and likely other drivers.

      2. File called repro.rb contains the following code:

      require 'bundler/inline'
      gemfile do
        source 'https://rubygems.org'
        gem 'mongo'
      end
      Mongo::Logger.logger.level = Logger::DEBUG
      client = Mongo::Client.new('mongodb://127.0.0.1/test')
      collection = client[:foo]
      puts collection.find( { rubyprogramtestRegexWihtM: /(?-i)AA_/im } ).first

      3. File called repro2.rb contains the following code:

      require 'bundler/inline'
      gemfile do
        source 'https://rubygems.org'
        gem 'mongo'
      end
      Mongo::Logger.logger.level = Logger::DEBUG
      client = Mongo::Client.new('mongodb://127.0.0.1/test')
      collection = client[:foo]
      puts collection.find( { rubyprogramtestRegexWihtoutM: /(?-i)AA_/i } ).first

       

      — Steps to reproduce —

      #lauching mongodb*

      mlaunch --single

      #setting profiler to 2
      mongo localhost/test --eval "db.setProfilingLevel(2)"

      #executing first repro, please note we are specifyng /im here
      ruby repro.rb

      #attempt to read the system.profile()
      mongo localhost/test --eval "db.system.profile.find()"

      Expected error: Error: Error: SyntaxError: invalid regular expression flag s

      #dumping the system.profile collection:
      mongoexport -d test -c system.profile | grep rubyprogramtestRegexWihtM

      #cleaning the system profile collection for a new test without /m*
      mongo localhost/test --eval "db.setProfilingLevel(0); db.system.profile.drop();db.setProfilingLevel(2);"

      #executing the second test without specifying /m*
      ruby repro2.rb

      #attempt to read the system.profile()
      mongo localhost/test --eval "db.system.profile.find()"

      expected error: Error: invalid regexp group

      #dumping the system.profile collection:
      mongoexport -d test -c system.profile | grep rubyprogramtestRegexWihtoutM

      Show
        1. Using Ruby but it also works on C# and likely other drivers. 2. File called repro.rb contains the following code: require 'bundler/inline' gemfile do source 'https: //rubygems.org' gem 'mongo' end Mongo::Logger.logger.level = Logger::DEBUG client = Mongo::Client. new ( 'mongodb: //127.0.0.1/test' ) collection = client[:foo] puts collection.find( { rubyprogramtestRegexWihtM: /(?-i)AA_/im } ).first 3. File called repro2.rb contains the following code: require 'bundler/inline' gemfile do source 'https: //rubygems.org' gem 'mongo' end Mongo::Logger.logger.level = Logger::DEBUG client = Mongo::Client. new ( 'mongodb: //127.0.0.1/test' ) collection = client[:foo] puts collection.find( { rubyprogramtestRegexWihtoutM: /(?-i)AA_/i } ).first   — Steps to reproduce — #lauching mongodb * mlaunch --single #setting profiler to 2 mongo localhost/test --eval "db.setProfilingLevel(2)" #executing first repro, please note we are specifyng /im here ruby repro.rb #attempt to read the system.profile() mongo localhost/test --eval "db.system.profile.find()" Expected error: Error: Error: SyntaxError: invalid regular expression flag s #dumping the system.profile collection: mongoexport -d test -c system.profile | grep rubyprogramtestRegexWihtM #cleaning the system profile collection for a new test without /m * mongo localhost/test --eval "db.setProfilingLevel(0); db.system.profile.drop();db.setProfilingLevel(2);" #executing the second test without specifying /m * ruby repro2.rb #attempt to read the system.profile() mongo localhost/test --eval "db.system.profile.find()" expected error: Error: invalid regexp group #dumping the system.profile collection: mongoexport -d test -c system.profile | grep rubyprogramtestRegexWihtoutM
    • Query Execution 2021-03-22

      When running find command on system.profile if the recorded command contains specific regex the shell is returning an error.

       

      Some error messages are:
      1.  SyntaxError: invalid regular expression flag s
      2. Error: invalid regexp group

      Repro attached

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            adamo.tonete@mongodb.com Adamo Tonete (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: