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

Collection.deleteOne() ignores hint

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Execution
    • ALL
    • Hide

      (function() {
             "use strict";
       
             const coll = db['deleteone_ignores_hint'];
             coll.drop();
             coll.insertOne({_id:1});
             db.runCommand({delete: coll.getName(), 
                       deletes: [{q: {_id:1}, limit: 1, hint: {$natural:1}}]}); // This uses the hint.
             assert.eq(0, coll.aggregate( [ { $indexStats: { } }]).toArray()[0].accesses.ops);
       
             coll.deleteOne({_id:1},{hint:{$natural:1}}); // This doesn't.
             assert.eq(0, coll.aggregate( [ { $indexStats: { } }]).toArray()[0].accesses.ops)
      })();
      

      Show
      ( function () { "use strict" ;   const coll = db[ 'deleteone_ignores_hint' ]; coll.drop(); coll.insertOne({_id:1}); db.runCommand({ delete : coll.getName(), deletes: [{q: {_id:1}, limit: 1, hint: {$natural:1}}]}); // This uses the hint. assert.eq(0, coll.aggregate( [ { $indexStats: { } }]).toArray()[0].accesses.ops);   coll.deleteOne({_id:1},{hint:{$natural:1}}); // This doesn't. assert.eq(0, coll.aggregate( [ { $indexStats: { } }]).toArray()[0].accesses.ops) })();

    Description

      The method deleteOne() accepts a hint but currently it is ignored, at least when using the $natural parameter.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            daniel.gomezferro@mongodb.com Daniel Gomez Ferro
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: