Query with hint({$natural: -1}) returns documents in a forward order

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.10
    • Component/s: Querying
    • None
    • ALL
    • Hide
      db.foo.ensureIndex({a:1});
      var docNum=10;
      for (var i=0; i< docNum; i++) {
         db.insert({a: Math.floor(Math.random()*docNum), b: i});
      }
      c.find({}).sort({$natural:-1})
      c.find({}).hint({$natural:-1})
      
      Show
      db.foo.ensureIndex({a:1}); var docNum=10; for ( var i=0; i< docNum; i++) { db.insert({a: Math .floor( Math .random()*docNum), b: i}); } c.find({}).sort({$natural:-1}) c.find({}).hint({$natural:-1})
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The query hint method, when specified with the $natural, always returns documents in a forward order. Note - the sort method works correctly.

              Assignee:
              Unassigned
              Reporter:
              Jonathan Abrahams (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: