bool mongoc_bulk_operation_insert_with_opts (mongoc_bulk_operation_t *bulk, const bson_t *document, const bson_t *opts, bson_error_t *error) { .... if (opts && bson_iter_init_find_case (&iter, opts, "legacyIndex") && bson_iter_as_bool (&iter)) { if (!_mongoc_validate_legacy_index (document, error)) { return false; } } else if (!_mongoc_validate_new_document (document, error)) { return false; }
When creating a bulk of large number of small documents the _mongoc_validate_new_document () takes 20% of the total execution time, including a localhost roundtrip.
When creating a bulk of few but very large documents, _mongoc_validate_new_document() takes up to 90% of the time.
I think we can reduce this validation significantly. It should be a programming error to provide corrupt bson_t for example.
Maybe add a flag to the opts to skip the validation, which would assume the bson_t was already bson_validate()d by the application before presented to the bulk operations.
- depends on
-
CDRIVER-2296 Option to pass bson_validate_flags_t to update/insert functions
- Closed
- is depended on by
-
CDRIVER-2461 Use validate: 0 in C Driver benchmarks
- Closed
-
CDRIVER-2304 Deprecate mongoc_collection_update
- Closed
- is related to
-
CDRIVER-1341 Driver should validate BSON documents before insert and update
- Closed
- related to
-
CDRIVER-2959 "validate" option is passed in command
- Closed