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

Clean up unneeded code for $natural hint overriding $natural sort

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Querying
    • Query Optimization
    • Minor Change

    Description

      Right now the only way to return documents in natural order is to use a collection scan cursor (not an index cursor). And, currently, if both an index hint and natural ordering are specified for a query, the hint will supersede the natural ordering spec and the results will not be returned in natural order. Instead, hinting an index that cannot be used to retrieve results in natural order should produce an error.

      Test

      c = db.c;
      c.drop();
      c.ensureIndex( { a:1 } );
      c.save( { a:2 } );
      c.save( { a:1 } );
       
      printjson( c.find( { a:{ $gt:0 } } ).sort( { $natural:1 } ).hint( { a:1 } ).toArray() );
      printjson( c.find( { a:{ $gt:0 } } ).sort( { $natural:1 } ).hint( { a:1 } ).explain() );

      Attachments

        Issue Links

          Activity

            People

              backlog-query-optimization Backlog - Query Optimization
              aaron Aaron Staple
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: