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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.5.4
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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().

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

              Created:
              Updated:
              Resolved: