Index: library/mongodb/nsfmongo.c =================================================================== diff -u -r4b99da620d8f9099dafa48f1099b5fbd5737aba5 -rc5e8bf0a69a1029a680efd4c7220b2333b92ebab --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 4b99da620d8f9099dafa48f1099b5fbd5737aba5) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision c5e8bf0a69a1029a680efd4c7220b2333b92ebab) @@ -928,15 +928,6 @@ } */ -/* - * The call "mongoc_collection_create_index" is deprecated and should be - * replaced by "mongoc_database_write_command_with_opts". However, this call - * requires "db", which is member of mongoc_collection_t, but not public - * accessible, and up to now, there is apparently no API to access this - * member. - */ -#define NSF_MONGO_COLLECTION_INDEX 1 - static int NsfMongoCollectionIndex(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, @@ -953,11 +944,9 @@ bson_t keys, *keysPtr = &keys; bson_error_t bsonError; mongoc_index_opt_t options; -#if !defined(NSF_MONGO_COLLECTION_INDEX) bson_t *create_indexes; char *index_name; const char *collection_name; -#endif result = Tcl_ListObjGetElements(interp, attributesObj, &objc, &objv); if (result != TCL_OK || ((objc % 3) != 0)) { @@ -966,7 +955,6 @@ BsonAppendObjv(interp, keysPtr, objc, objv); -#if !defined(NSF_MONGO_COLLECTION_INDEX) index_name = mongoc_collection_keys_to_index_string(keysPtr); collection_name = mongoc_collection_get_name(collectionPtr); @@ -981,7 +969,6 @@ BCON_UTF8(index_name), "}", "]"); -#endif mongoc_index_opt_init(&options); if (withBackground != 0) {options.background = 1;} @@ -992,19 +979,15 @@ if (withName != 0) {options.name = withName;} /* TODO: not handled: is_initialized, v, weights, default_language, language_override, padding */ -#if !defined(NSF_MONGO_COLLECTION_INDEX) - success = mongoc_database_write_command_with_opts( - collectionPtr->db, + success = mongoc_collection_write_command_with_opts( + collectionPtr, create_indexes, NULL /* opts */, NULL /*&reply*/, &bsonError); bson_destroy(keysPtr); bson_free(index_name); bson_destroy (create_indexes); -#else - success = mongoc_collection_create_index(collectionPtr, keysPtr, &options, &bsonError); -#endif Tcl_SetObjResult(interp, Tcl_NewBooleanObj(success)); return TCL_OK;