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

Add mode to AutoGetCollection to create collection if it doesn't exist

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing

      There is an ensureDb() function but no equivalent to ensureCollection.

      There are workarounds being used throughout the code to wrap the AutoGetCollection in a boost::optional to be able to re-construct it after the collection has been created.

      Other places just uses the raw Collection* from the AutoGetCollection so it can be set to a newly created Collection and the AutoGetCollection is just used to hold the locks in that case.

      With lock free reads the latter approach could be dangerous as the extracted Collection pointer may dangle after a writable collection is requested or we yield inside query.

      A new flag to AutoGetCollection to create collections if not existing could streamline and simplify code in many places.

            Assignee:
            Unassigned Unassigned
            Reporter:
            henrik.edin@mongodb.com Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: