-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
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.
- is related to
-
SERVER-71721 Avoid extra string copy in NamespaceString constructor
- Closed