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

Mutator methods which return non-void should document their return value

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc0
    • Affects Version/s: None
    • Component/s: Documentation
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Tentative list of methods to document:

      $ git grep -E '^ +[a-z_]+&.*);$' | grep -v iterator | grep -v operator
      src/mongocxx/model/delete_many.hpp:    delete_many& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/model/delete_one.hpp:    delete_one& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/model/replace_one.hpp:    replace_one& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/model/replace_one.hpp:    replace_one& upsert(bool upsert);
      src/mongocxx/model/update_many.hpp:    update_many& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/model/update_many.hpp:    update_many& upsert(bool upsert);
      src/mongocxx/model/update_one.hpp:    update_one& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/model/update_one.hpp:    update_one& upsert(bool upsert);
      src/mongocxx/options/aggregate.hpp:    aggregate& allow_disk_use(bool allow_disk_use);
      src/mongocxx/options/aggregate.hpp:    aggregate& batch_size(std::int32_t batch_size);
      src/mongocxx/options/aggregate.hpp:    aggregate& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/aggregate.hpp:    aggregate& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/aggregate.hpp:    aggregate& use_cursor(bool use_cursor);
      src/mongocxx/options/aggregate.hpp:    aggregate& read_preference(class read_preference rp);
      src/mongocxx/options/aggregate.hpp:    aggregate& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/bulk_write.hpp:    bulk_write& ordered(bool ordered);
      src/mongocxx/options/bulk_write.hpp:    bulk_write& write_concern(class write_concern wc);
      src/mongocxx/options/bulk_write.hpp:    bulk_write& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/client.hpp:    client& ssl_opts(ssl ssl_opts);
      src/mongocxx/options/count.hpp:    count& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/count.hpp:    count& hint(class hint index_hint);
      src/mongocxx/options/count.hpp:    count& limit(std::int64_t limit);
      src/mongocxx/options/count.hpp:    count& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/count.hpp:    count& skip(std::int64_t skip);
      src/mongocxx/options/count.hpp:    count& read_preference(class read_preference rp);
      src/mongocxx/options/create_collection.hpp:    create_collection& capped(bool capped);
      src/mongocxx/options/create_collection.hpp:    create_collection& auto_index_id(bool auto_index_id);
      src/mongocxx/options/create_collection.hpp:    create_collection& size(int max_size);
      src/mongocxx/options/create_collection.hpp:    create_collection& max(int max_documents);
      src/mongocxx/options/create_collection.hpp:    create_collection& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/create_collection.hpp:    create_collection& storage_engine(bsoncxx::document::view_or_value storage_engine_opts);
      src/mongocxx/options/create_collection.hpp:    create_collection& no_padding(bool no_padding);
      src/mongocxx/options/create_collection.hpp:    create_collection& validation_criteria(class validation_criteria validation);
      src/mongocxx/options/create_view.hpp:    create_view& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/create_view.hpp:    create_view& pipeline(pipeline pipeline);
      src/mongocxx/options/delete.hpp:    delete_options& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/delete.hpp:    delete_options& write_concern(write_concern wc);
      src/mongocxx/options/distinct.hpp:    distinct& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/distinct.hpp:    distinct& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/distinct.hpp:    distinct& read_preference(class read_preference rp);
      src/mongocxx/options/find.hpp:    find& allow_partial_results(bool allow_partial);
      src/mongocxx/options/find.hpp:    find& batch_size(std::int32_t batch_size);
      src/mongocxx/options/find.hpp:    find& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/find.hpp:    find& comment(bsoncxx::string::view_or_value comment);
      src/mongocxx/options/find.hpp:    find& cursor_type(cursor::type cursor_type);
      src/mongocxx/options/find.hpp:    find& hint(class hint index_hint);
      src/mongocxx/options/find.hpp:    find& limit(std::int32_t limit);
      src/mongocxx/options/find.hpp:    find& max(bsoncxx::document::view_or_value max);
      src/mongocxx/options/find.hpp:    find& max_await_time(std::chrono::milliseconds max_await_time);
      src/mongocxx/options/find.hpp:    find& max_scan(std::int32_t max);
      src/mongocxx/options/find.hpp:    find& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/find.hpp:    find& min(bsoncxx::document::view_or_value min);
      src/mongocxx/options/find.hpp:    find& modifiers(bsoncxx::document::view_or_value modifiers);
      src/mongocxx/options/find.hpp:    find& no_cursor_timeout(bool no_cursor_timeout);
      src/mongocxx/options/find.hpp:    find& projection(bsoncxx::document::view_or_value projection);
      src/mongocxx/options/find.hpp:    find& read_preference(class read_preference rp);
      src/mongocxx/options/find.hpp:    find& return_key(bool return_key);
      src/mongocxx/options/find.hpp:    find& show_record_id(bool show_record_id);
      src/mongocxx/options/find.hpp:    find& skip(std::int32_t skip);
      src/mongocxx/options/find.hpp:    find& snapshot(bool snapshot);
      src/mongocxx/options/find.hpp:    find& sort(bsoncxx::document::view_or_value ordering);
      src/mongocxx/options/find_one_and_delete.hpp:    find_one_and_delete& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/find_one_and_delete.hpp:    find_one_and_delete& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/find_one_and_delete.hpp:    find_one_and_delete& projection(bsoncxx::document::view_or_value projection);
      src/mongocxx/options/find_one_and_delete.hpp:    find_one_and_delete& sort(bsoncxx::document::view_or_value ordering);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& projection(bsoncxx::document::view_or_value projection);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& return_document(return_document return_document);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& sort(bsoncxx::document::view_or_value ordering);
      src/mongocxx/options/find_one_and_replace.hpp:    find_one_and_replace& upsert(bool upsert);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& max_time(std::chrono::milliseconds max_time);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& projection(bsoncxx::document::view_or_value projection);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& return_document(return_document return_document);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& sort(bsoncxx::document::view_or_value ordering);
      src/mongocxx/options/find_one_and_update.hpp:    find_one_and_update& upsert(bool upsert);
      src/mongocxx/options/index.hpp:    index& background(bool background);
      src/mongocxx/options/index.hpp:    index& unique(bool unique);
      src/mongocxx/options/index.hpp:    index& name(bsoncxx::string::view_or_value name);
      src/mongocxx/options/index.hpp:    index& collation(bsoncxx::document::view collation);
      src/mongocxx/options/index.hpp:    index& sparse(bool sparse);
      src/mongocxx/options/index.hpp:    index& storage_options(std::unique_ptr<base_storage_options> storage_options);
      src/mongocxx/options/index.hpp:    index& storage_options(std::unique_ptr<wiredtiger_storage_options> storage_options);
      src/mongocxx/options/index.hpp:    index& expire_after(std::chrono::seconds seconds);
      src/mongocxx/options/index.hpp:    index& version(std::int32_t v);
      src/mongocxx/options/index.hpp:    index& weights(bsoncxx::document::view weights);
      src/mongocxx/options/index.hpp:    index& default_language(bsoncxx::string::view_or_value default_language);
      src/mongocxx/options/index.hpp:    index& language_override(bsoncxx::string::view_or_value language_override);
      src/mongocxx/options/index.hpp:    index& partial_filter_expression(bsoncxx::document::view partial_filter_expression);
      src/mongocxx/options/index.hpp:    index& twod_sphere_version(std::uint8_t twod_sphere_version);
      src/mongocxx/options/index.hpp:    index& twod_bits_precision(std::uint8_t twod_bits_precision);
      src/mongocxx/options/index.hpp:    index& twod_location_min(double twod_location_min);
      src/mongocxx/options/index.hpp:    index& twod_location_max(double twod_location_max);
      src/mongocxx/options/index.hpp:    index& haystack_bucket_size(double haystack_bucket_size);
      src/mongocxx/options/insert.hpp:    insert& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/insert.hpp:    insert& write_concern(class write_concern wc);
      src/mongocxx/options/insert.hpp:    insert& ordered(bool ordered);
      src/mongocxx/options/modify_collection.hpp:    modify_collection& no_padding(bool no_padding);
      src/mongocxx/options/modify_collection.hpp:    modify_collection& validation_criteria(class validation_criteria validation);
      src/mongocxx/options/ssl.hpp:    ssl& pem_file(bsoncxx::string::view_or_value pem_file);
      src/mongocxx/options/ssl.hpp:    ssl& pem_password(bsoncxx::string::view_or_value pem_password);
      src/mongocxx/options/ssl.hpp:    ssl& ca_file(bsoncxx::string::view_or_value ca_file);
      src/mongocxx/options/ssl.hpp:    ssl& ca_dir(bsoncxx::string::view_or_value ca_dir);
      src/mongocxx/options/ssl.hpp:    ssl& crl_file(bsoncxx::string::view_or_value crl_file);
      src/mongocxx/options/ssl.hpp:    ssl& allow_invalid_certificates(bool allow_invalid_certificates);
      src/mongocxx/options/update.hpp:    update& bypass_document_validation(bool bypass_document_validation);
      src/mongocxx/options/update.hpp:    update& collation(bsoncxx::document::view_or_value collation);
      src/mongocxx/options/update.hpp:    update& upsert(bool upsert);
      src/mongocxx/options/update.hpp:    update& write_concern(class write_concern wc);
      src/mongocxx/pipeline.hpp:    pipeline& group(bsoncxx::document::view_or_value group);
      src/mongocxx/pipeline.hpp:    pipeline& limit(std::int32_t limit);
      src/mongocxx/pipeline.hpp:    pipeline& lookup(bsoncxx::document::view_or_value lookup);
      src/mongocxx/pipeline.hpp:    pipeline& match(bsoncxx::document::view_or_value filter);
      src/mongocxx/pipeline.hpp:    pipeline& out(std::string collection_name);
      src/mongocxx/pipeline.hpp:    pipeline& project(bsoncxx::document::view_or_value projection);
      src/mongocxx/pipeline.hpp:    pipeline& redact(bsoncxx::document::view_or_value restrictions);
      src/mongocxx/pipeline.hpp:    pipeline& sample(std::int32_t size);
      src/mongocxx/pipeline.hpp:    pipeline& skip(std::int32_t skip);
      src/mongocxx/pipeline.hpp:    pipeline& sort(bsoncxx::document::view_or_value ordering);
      src/mongocxx/pipeline.hpp:    pipeline& unwind(std::string field_name);
      src/mongocxx/validation_criteria.hpp:    validation_criteria& rule(bsoncxx::document::view_or_value rule);
      src/mongocxx/validation_criteria.hpp:    validation_criteria& level(validation_level level);
      src/mongocxx/validation_criteria.hpp:    validation_criteria& action(validation_action action);
      

      Perhaps we could blanket-add a comment like the following to all of the above:

      // @return
      //   A reference to the object on which this member function is being called.  This facilitates method chaining.
      

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            rassi J Rassi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: