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

Audit string arguments

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • 4.0.0
    • None
    • None
    • None
    • 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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: