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

Return StringData from DatabaseName::db()

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Serverless
    • Fully Compatible
    • 2

      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.

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

              Created:
              Updated:
              Resolved: