Explain for 'distinct' and 'count' doesn't work when database doesn't exist.

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • Hide
      let unexistentDb = db.getSiblingDB("unexistentDB");
      
      unexistentDb.runCommand({explain:{distinct:"coll"}}); // throws NamespaceNotFound
      unexistentDb.runCommand({explain:{count:"coll"}}); // throws NamespaceNotFound

       

      Show
      let unexistentDb = db.getSiblingDB("unexistentDB"); unexistentDb.runCommand({explain:{distinct:"coll"}}); // throws NamespaceNotFound unexistentDb.runCommand({explain:{count:"coll"}}); // throws NamespaceNotFound  
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Right now the explain command works for 'find', 'aggregate' and other commands when the database doesn't exist. However, this is not the case for 'distinct' and 'count', which fail with a NamespaceNotFound.

       

      It would also be good to add a test to check this behavior.

              Assignee:
              Unassigned
              Reporter:
              Silvia Surroca
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: