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

AutoGetCollectionForReadCommandMaybeLockFree operator bool not consistent with AutoGetCollectionForReadCommandMaybeLockFree::getCollection operator bool

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • Execution Team 2022-03-07

      AutoGetCollectionForReadCommandMaybeLockFree::operator bool is supposed to be a shortcut to AutoGetCollectionForReadCommandMaybeLockFree::getCollection::operator bool, i.e. it returns true if a collection with the provided namespace exists, or false otherwise. However, in the case where such a collection does not exists, it appears that it is not behaving as expected:

      AutoGetCollectionForReadCommandMaybeLockFree coll{...};  // Collection does not exist
      logd("coll {} coll->getCollection() {}",
           static_cast<bool>(coll),
           static_cast<bool>(coll->getCollection()));
      
      coll true coll->getCollection() false
      

            Assignee:
            gregory.noma@mongodb.com Gregory Noma
            Reporter:
            gregory.noma@mongodb.com Gregory Noma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: