Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2270

Audit string arguments

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: