Skip to content

Commit e25b7e9

Browse files
committed
CXX-596 implement collection::list_indexes
1 parent b50b4cc commit e25b7e9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/mongocxx/collection.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,17 @@ cursor collection::distinct(bsoncxx::stdx::string_view field_name, bsoncxx::docu
458458
return cursor(result);
459459
}
460460

461+
cursor collection::list_indexes() const {
462+
bson_error_t error;
463+
auto result = libmongoc::collection_find_indexes(_impl->collection_t, &error);
464+
465+
if (!result) {
466+
throw exception::operation(std::make_tuple(error.message, error.code));
467+
}
468+
469+
return cursor(result);
470+
}
471+
461472
void collection::drop() {
462473
bson_error_t error;
463474

src/mongocxx/private/libmongoc_symbols.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ MONGOCXX_LIBMONGOC_SYMBOL(collection_aggregate)
4040
MONGOCXX_LIBMONGOC_SYMBOL(collection_count)
4141
MONGOCXX_LIBMONGOC_SYMBOL(collection_create_index)
4242
MONGOCXX_LIBMONGOC_SYMBOL(collection_destroy)
43+
MONGOCXX_LIBMONGOC_SYMBOL(collection_find_indexes)
4344
MONGOCXX_LIBMONGOC_SYMBOL(collection_set_read_prefs)
4445
MONGOCXX_LIBMONGOC_SYMBOL(collection_get_read_prefs)
4546
MONGOCXX_LIBMONGOC_SYMBOL(collection_set_write_concern)

0 commit comments

Comments
 (0)