Details
Description
NamespaceString::ns and DatabaseName::db both return const std::string& to their own std::string storage. This leads to difficult-to-maintain code because the lifetime of the returned value is unclear: sometimes it results in a copy, other times it remains a const-ref.
With the upcoming changes in SERVER-75529, we no longer have the option of returning a const-ref to a member variable. Having these methods return std::string violates assumptions of some call sites due to the aforementioned lifetime ambiguity. This ticket is a pre-requisite, it will change these methods to return a StringData which will a) clarify the lifetime assumptions at the callsite, b) ease the transition to the changes proposed in SERVER-75529.