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

Return StringData from DatabaseName::db()

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • None
    • None
    • Serverless
    • Fully Compatible
    • 2

    Description

      Currently, DatabaseName::db() returns a const std::string&, which is fine for the most part. However, it's easy to assign the output in a way that copies the underlying string without realizing it (e.g. auto db = dbName.db() instead of const auto& db = dbName.db()). Changing the return type to StringData would require the caller to opt-in to copy behavior via StringData::toString(), or simply calling DatabaseName::toString() to begin with.

      Attachments

        Activity

          People

            backlog-server-serverless [DO NOT USE] Backlog - Server Serverless (Inactive)
            dan.larkin-york@mongodb.com Dan Larkin-York
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: