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

numeric named element selection semantics differ for regular expressions, $all

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.4
    • None
    • Querying
    • None
    • ALL

    Description

      The element selection semantics for a numeric field name within an array differ between regular expressions and other query operators. We should make regular expressions consistent with the other operators.

      c = db.c;
      c.drop();
       
      c.save( { a:[ { 1:'x' }, 'y' ] } );
      assert.eq( 1, c.count( { 'a.1':'x' } ) );
      assert.eq( 1, c.count( { 'a.1':'y' } ) );
      // Does not match, because arrays are not expanded to find nested numeric field names, when matching a regular expression.          
      assert.eq( 1, c.count( { 'a.1':/x/ } ) );
      assert.eq( 1, c.count( { 'a.1':/y/ } ) );

      Similar behavior with $all, which also uses getFieldsDotted().

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: