CDRIVER-3755 Provide an index creation helper (#1303)
* format mongoc-collection.c * add `mongoc_collection_create_indexes_with_opts` * make `assert_match_bson` a macro Includes the caller's file and line number on error. * fixup `hex_to_bin` helper - return NULL if `hex` is NULL - set `len` to 0 on error This fixes a possible crash if LOCAL_MASTERKEY is not set in the example. * update legacy test runner to use `mongoc_collection_create_indexes_with_opts` * use `mongoc_collection_create_indexes_with_opts` in `create_collection_with_encryptedFields` * use `mongoc_collection_create_indexes_with_opts` in `operation_create_index` * fix placement of `strlen` `strlen` was called was before `to_encrypt.value.v_utf8.str` was assigned. This resulted in a `strlen` call with `NULL` argument. * use `mongoc_collection_create_indexes_with_opts` in examples * add documentation page for `mongoc_collection_create_indexes_with_opts` * update "Creating Indexes" guide * add file name to example error message Co-authored-by:vector-of-bool <vectorofbool@gmail.com> * fix documented type of `models` to include `*` Co-authored-by:
Ezra Chung <88335979+eramongodb@users.noreply.github.com> * simplify error handling Co-authored-by:
Ezra Chung <88335979+eramongodb@users.noreply.github.com> * revise assert message Co-authored-by:
Ezra Chung <88335979+eramongodb@users.noreply.github.com> * use `mongoc_collection_create_indexes_with_opts` in more tests * rename FAIL to HANDLE_ERROR * document "success" and "failure" paths in example * rename guide page to "Manage Collection Indexes" * rename guide file to `manage-collection-indexes.rst` * rename `example-create-indexes.c` to `example-manage-collection-indexes.c` * add "See Also" sections * link to `createIndexes` documentation for form of `keys` * document `mongoc_index_model_t` * change `BSON_ASSERT` to `return NULL;` * make pointer argument const --------- Co-authored-by:
vector-of-bool <vectorofbool@gmail.com> Co-authored-by:
Ezra Chung <88335979+eramongodb@users.noreply.github.com>
parent
b3a11d00
Please register or sign in to comment