[CXX-2270] Audit string arguments Created: 24/May/21  Updated: 07/Feb/24

Status: Backlog
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 4.0.0

Type: Task Priority: Major - P3
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CXX-2266 Use bsoncxx::string::view_or_value in... Backlog
Epic Link: C++ Developer Experience Improvements
Backwards Compatibility: Major Change

 Description   

There are three ways in which strings are accepted in the public API. Examples:

In src/bsoncxx/document/value.hpp

document::view::const_iterator find(stdx::string_view key) const;

In src/mongocxx/client.hpp:

class database database(bsoncxx::string::view_or_value name) const&;

In src/mongocxx/client_side_encryption.hpp

bsoncxx::types::bson_value::value create_data_key(std::string kms_provider,
                                                  const options::data_key& opts = {});

We should be consistent based on whether the callee needs to retain a copy of the argument. The rule may be: accept a string_view when the callee does not to copy, and use a bsoncxx::string::view_or_value if the callee does need to retain a copy.


Generated at Wed Feb 07 22:05:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.