#include <Database.h>
A named database in a Mongo DB instance.
Definition at line 19 of file Database.h.
◆ Database() [1/2]
Database::Database |
( |
mongoc_client_pool_t * |
pool, |
|
|
std::string_view |
db_name |
|
) |
| |
Definition at line 11 of file Database.cpp.
13 client_ = mongoc_client_pool_pop(pool_);
14 db_ = mongoc_client_get_database(client_, db_name.data());
◆ ~Database() [1/2]
Definition at line 17 of file Database.cpp.
18 mongoc_database_destroy(db_);
19 mongoc_client_pool_push(pool_, client_);
◆ Database() [2/2]
knowrob::mongo::Database::Database |
( |
mongoc_client_pool_t * |
pool, |
|
|
std::string_view |
db_name |
|
) |
| |
◆ ~Database() [2/2]
knowrob::mongo::Database::~Database |
( |
| ) |
|
◆ create_index() [1/2]
bool Database::create_index |
( |
const char * |
coll_name, |
|
|
const std::vector< IndexKey > & |
indexes |
|
) |
| |
Definition at line 22 of file Database.cpp.
28 for (
auto &is : indexes) {
29 BSON_APPEND_INT32(&keys, is.value.c_str(), (
int)is.type);
31 char *index_name = mongoc_collection_keys_to_index_string(&keys);
33 bson_t *cmd = BCON_NEW (
"createIndexes", BCON_UTF8(coll_name),
35 "key", BCON_DOCUMENT(&keys),
36 "name", BCON_UTF8(index_name),
39 bool success = mongoc_database_write_command_with_opts(
40 db_, cmd,
nullptr , &reply, &err);
41 bson_free(index_name);
◆ create_index() [2/2]
bool knowrob::mongo::Database::create_index |
( |
const char * |
coll_name, |
|
|
const std::vector< IndexKey > & |
indexes |
|
) |
| |
◆ db() [1/2]
mongoc_database_t* knowrob::mongo::Database::db |
( |
| ) |
|
|
inline |
◆ db() [2/2]
mongoc_database_t* knowrob::mongo::Database::db |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following files:
- build/_CPack_Packages/Linux/DEB/knowrob-2.1.0-Linux/usr/include/knowrob/storage/mongo/Database.h
- src/storage/mongo/Database.cpp