Loading...
Searching...
No Matches
mongocxx::v1::search_indexes Class Reference

`#include <mongocxx/v1/search_indexes.hpp>`

## Description

Support for MongoDB Atlas Search indexes.

Note
  Not to be confused with collection indexes or Atlas Vector Search indexes.

See also
  - Queries and Indexes (MongoDB Manual)

## Classes

class | model
| A description of a MongoDB Atlas Search index. More...

## Public Member Functions

| search_indexes (search_indexes &&other) noexcept
| Move constructor.
| search_indexes (search_indexes const &other)
| Copy construction.
| ~search_indexes ()
| Destroy this object.
std::vector< std::string > | create_many (std::vector< model > const &indexes)
| Create multiple search indexes in the associated collection.
std::vector< std::string > | create_many (v1::client_session const &session, std::vector< model > const &indexes)
| Create multiple search indexes in the associated collection.
std::string | create_one (bsoncxx::v1::document::view definition)
| Create a single search index in the associated collection.
std::string | create_one (bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view definition)
| Create a single search index in the associated collection.
std::string | create_one (model const &index)
| Create a single search index in the associated collection.
std::string | create_one (v1::client_session const &session, bsoncxx::v1::document::view definition)
| Create a single search index in the associated collection.
std::string | create_one (v1::client_session const &session, bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view definition)
| Create a single search index in the associated collection.
std::string | create_one (v1::client_session const &session, model const &index)
| Create a single search index in the associated collection.
void | drop_one (bsoncxx::v1::stdx::string_view name)
| Drop the search index with the given name in the associated collection.
void | drop_one (v1::client_session const &session, bsoncxx::v1::stdx::string_view name)
| Drop the search index with the given name in the associated collection.
v1::cursor | list (bsoncxx::v1::stdx::string_view name, v1::aggregate_options const &opts={})
| Return information for the search index with the given name in the associated collection.
v1::cursor | list (v1::aggregate_options const &opts={})
| Return information for all search indexes in the associated collection.
v1::cursor | list (v1::client_session const &session, bsoncxx::v1::stdx::string_view name, v1::aggregate_options const &opts={})
| Return information for the search index with the given name in the associated collection.
v1::cursor | list (v1::client_session const &session, v1::aggregate_options const &opts={})
| Return information for all search indexes in the associated collection.
search_indexes & | operator= (search_indexes &&other) noexcept
| Move assignment.
search_indexes & | operator= (search_indexes const &other)
| Copy assignment.
void | update_one (bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view definition)
| Update the definition of the search index with the given name in the associated collection.
void | update_one (v1::client_session const &session, bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view definition)
| Update the definition of the search index with the given name in the associated collection.

## Constructor & Destructor Documentation

## ~search_indexes()

mongocxx::v1::search_indexes::~search_indexes | ( |  | ) |

Destroy this object.

Warning
  Invalidates all associated views.

## search_indexes() [1/2]

mongocxx::v1::search_indexes::search_indexes | ( | search_indexes && | other | ) |

noexcept

Move constructor.

Postconditions:
  - other is in an assign-or-destroy-only state.

## search_indexes() [2/2]

mongocxx::v1::search_indexes::search_indexes | ( | search_indexes const & | other | ) |

Copy construction.

## Member Function Documentation

## create_many() [1/2]

std::vector< std::string > mongocxx::v1::search_indexes::create_many | ( | std::vector< model > const & | indexes | ) |

Create multiple search indexes in the associated collection.

Returns
  The names of the new search indexes

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_many() [2/2]

std::vector< std::string > mongocxx::v1::search_indexes::create_many | ( | v1::client_session const & | session,
|  | std::vector< model > const & | indexes )

Create multiple search indexes in the associated collection.

Returns
  The names of the new search indexes.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [1/6]

std::string mongocxx::v1::search_indexes::create_one | ( | bsoncxx::v1::document::view | definition | ) |

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [2/6]

std::string mongocxx::v1::search_indexes::create_one | ( | bsoncxx::v1::stdx::string_view | name,
|  | bsoncxx::v1::document::view | definition )

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [3/6]

std::string mongocxx::v1::search_indexes::create_one | ( | model const & | index | ) |

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [4/6]

std::string mongocxx::v1::search_indexes::create_one | ( | v1::client_session const & | session,
|  | bsoncxx::v1::document::view | definition )

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [5/6]

std::string mongocxx::v1::search_indexes::create_one | ( | v1::client_session const & | session,
|  | bsoncxx::v1::stdx::string_view | name,
|  | bsoncxx::v1::document::view | definition )

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## create_one() [6/6]

std::string mongocxx::v1::search_indexes::create_one | ( | v1::client_session const & | session,
|  | model const & | index )

Create a single search index in the associated collection.

Equivalent to this->create_many(...) with a single search index model.

Returns
  The name of the new search index.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - createSearchIndexes (database command) (MongoDB Manual)

## drop_one() [1/2]

void mongocxx::v1::search_indexes::drop_one | ( | bsoncxx::v1::stdx::string_view | name | ) |

Drop the search index with the given name in the associated collection.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - dropSearchIndex (database command) (MongoDB Manual)

## drop_one() [2/2]

void mongocxx::v1::search_indexes::drop_one | ( | v1::client_session const & | session,
|  | bsoncxx::v1::stdx::string_view | name )

Drop the search index with the given name in the associated collection.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - dropSearchIndex (database command) (MongoDB Manual)

## list() [1/4]

v1::cursor mongocxx::v1::search_indexes::list | ( | bsoncxx::v1::stdx::string_view | name,
|  | v1::aggregate_options const & | opts = {} )

Return information for the search index with the given name in the associated collection.

## list() [2/4]

v1::cursor mongocxx::v1::search_indexes::list | ( | v1::aggregate_options const & | opts = {} | ) |

Return information for all search indexes in the associated collection.

## list() [3/4]

v1::cursor mongocxx::v1::search_indexes::list | ( | v1::client_session const & | session,
|  | bsoncxx::v1::stdx::string_view | name,
|  | v1::aggregate_options const & | opts = {} )

Return information for the search index with the given name in the associated collection.

## list() [4/4]

v1::cursor mongocxx::v1::search_indexes::list | ( | v1::client_session const & | session,
|  | v1::aggregate_options const & | opts = {} )

Return information for all search indexes in the associated collection.

## operator=() [1/2]

search_indexes & mongocxx::v1::search_indexes::operator= | ( | search_indexes && | other | ) |

noexcept

Move assignment.

Postconditions:
  - other is in an assign-or-destroy-only state.

## operator=() [2/2]

search_indexes & mongocxx::v1::search_indexes::operator= | ( | search_indexes const & | other | ) |

Copy assignment.

## update_one() [1/2]

void mongocxx::v1::search_indexes::update_one | ( | bsoncxx::v1::stdx::string_view | name,
|  | bsoncxx::v1::document::view | definition )

Update the definition of the search index with the given name in the associated collection.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - updateSearchIndex (database command) (MongoDB Manual)

## update_one() [2/2]

void mongocxx::v1::search_indexes::update_one | ( | v1::client_session const & | session,
|  | bsoncxx::v1::stdx::string_view | name,
|  | bsoncxx::v1::document::view | definition )

Update the definition of the search index with the given name in the associated collection.

Exceptions

  mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available.
  mongocxx::v1::exception | for all other runtime errors.

See also
  - updateSearchIndex (database command) (MongoDB Manual)

The documentation for this class was generated from the following file:

- mongocxx/v1/search_indexes.hpp