knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <Collection.h>
Public Member Functions | |
Collection (const std::shared_ptr< Connection > &connection, std::string_view databaseName, std::string_view collectionName) | |
Collection (const Collection &collection) | |
~Collection () | |
void | appendSession (bson_t *opts) |
mongoc_client_session_t * | session () |
auto | pool () |
auto | connection () |
auto | client () const |
auto | coll () |
const auto & | name () const |
const auto & | dbName () const |
const auto & | dbURI () const |
void | drop () |
std::vector< std::string > | distinctValues (std::string_view key) |
void | removeOne (const Document &document) |
void | removeOne (const bson_oid_t &oid) |
void | removeAll (const Document &document) |
void | storeOne (const Document &document) |
void | update (const Document &query, const Document &update, bool upsert=false) |
void | evalAggregation (const bson_t *pipeline) |
std::shared_ptr< BulkOperation > | createBulkOperation () |
void | createAscendingIndex (const std::vector< const char * > &keys) |
void | createIndex (const std::vector< IndexKey > &keys) |
void | createTripleIndex () |
bool | empty () |
Collection (const std::shared_ptr< Connection > &connection, std::string_view databaseName, std::string_view collectionName) | |
Collection (const Collection &collection) | |
~Collection () | |
void | appendSession (bson_t *opts) |
mongoc_client_session_t * | session () |
auto | pool () |
auto | connection () |
auto | client () const |
auto | coll () |
const auto & | name () const |
const auto & | dbName () const |
const auto & | dbURI () const |
void | drop () |
std::vector< std::string > | distinctValues (std::string_view key) |
void | removeOne (const Document &document) |
void | removeOne (const bson_oid_t &oid) |
void | removeAll (const Document &document) |
void | storeOne (const Document &document) |
void | update (const Document &query, const Document &update, bool upsert=false) |
void | evalAggregation (const bson_t *pipeline) |
std::shared_ptr< BulkOperation > | createBulkOperation () |
void | createAscendingIndex (const std::vector< const char * > &keys) |
void | createIndex (const std::vector< IndexKey > &keys) |
void | createTripleIndex () |
bool | empty () |
A named collection in Mongo DB. Note that a Mongo DB instance may contain multiple databases, each of which may contain multiple collections. This class represents a single collection.
Definition at line 23 of file Collection.h.
Collection::Collection | ( | const std::shared_ptr< Connection > & | connection, |
std::string_view | databaseName, | ||
std::string_view | collectionName | ||
) |
Definition at line 31 of file Collection.cpp.
Collection::Collection | ( | const Collection & | collection | ) |
Definition at line 44 of file Collection.cpp.
Collection::~Collection | ( | ) |
Definition at line 54 of file Collection.cpp.
knowrob::mongo::Collection::Collection | ( | const std::shared_ptr< Connection > & | connection, |
std::string_view | databaseName, | ||
std::string_view | collectionName | ||
) |
knowrob::mongo::Collection::Collection | ( | const Collection & | collection | ) |
knowrob::mongo::Collection::~Collection | ( | ) |
void Collection::appendSession | ( | bson_t * | opts | ) |
Append options to the session.
opts | some options |
Definition at line 72 of file Collection.cpp.
void knowrob::mongo::Collection::appendSession | ( | bson_t * | opts | ) |
Append options to the session.
opts | some options |
|
inline |
Definition at line 58 of file Collection.h.
|
inline |
Definition at line 58 of file Collection.h.
|
inline |
|
inline |
|
inline |
Definition at line 53 of file Collection.h.
|
inline |
Definition at line 53 of file Collection.h.
void Collection::createAscendingIndex | ( | const std::vector< const char * > & | keys | ) |
Create a search index where each key is sorted in ascending order.
keys | vector of keys |
Definition at line 227 of file Collection.cpp.
void knowrob::mongo::Collection::createAscendingIndex | ( | const std::vector< const char * > & | keys | ) |
Create a search index where each key is sorted in ascending order.
keys | vector of keys |
std::shared_ptr< BulkOperation > Collection::createBulkOperation | ( | ) |
std::shared_ptr<BulkOperation> knowrob::mongo::Collection::createBulkOperation | ( | ) |
void Collection::createIndex | ( | const std::vector< IndexKey > & | keys | ) |
Create a search index.
keys | vector of keys |
Definition at line 234 of file Collection.cpp.
void knowrob::mongo::Collection::createIndex | ( | const std::vector< IndexKey > & | keys | ) |
Create a search index.
keys | vector of keys |
void Collection::createTripleIndex | ( | ) |
Create a search index for s/p/o fields.
Definition at line 247 of file Collection.cpp.
void knowrob::mongo::Collection::createTripleIndex | ( | ) |
Create a search index for s/p/o fields.
|
inline |
|
inline |
|
inline |
Definition at line 78 of file Collection.h.
|
inline |
Definition at line 78 of file Collection.h.
std::vector< std::string > Collection::distinctValues | ( | std::string_view | key | ) |
key | the name of a field in mongo documents. |
Definition at line 89 of file Collection.cpp.
std::vector<std::string> knowrob::mongo::Collection::distinctValues | ( | std::string_view | key | ) |
key | the name of a field in mongo documents. |
void Collection::drop | ( | ) |
Drop this collection, removing all document it contains.
Definition at line 82 of file Collection.cpp.
void knowrob::mongo::Collection::drop | ( | ) |
Drop this collection, removing all document it contains.
bool Collection::empty | ( | ) |
bool knowrob::mongo::Collection::empty | ( | ) |
void Collection::evalAggregation | ( | const bson_t * | pipeline | ) |
Evaluate an aggregation pipeline without forwarding any resulting documents. e.g. useful for pipelines with $merge stage.
pipeline | a pipeline |
Definition at line 173 of file Collection.cpp.
void knowrob::mongo::Collection::evalAggregation | ( | const bson_t * | pipeline | ) |
Evaluate an aggregation pipeline without forwarding any resulting documents. e.g. useful for pipelines with $merge stage.
pipeline | a pipeline |
|
inline |
|
inline |
|
inline |
Definition at line 48 of file Collection.h.
|
inline |
Definition at line 48 of file Collection.h.
void Collection::removeAll | ( | const Document & | document | ) |
Remove all matching JSON documents from this collection.
document | a document pattern. |
Definition at line 131 of file Collection.cpp.
void knowrob::mongo::Collection::removeAll | ( | const Document & | document | ) |
Remove all matching JSON documents from this collection.
document | a document pattern. |
void Collection::removeOne | ( | const bson_oid_t & | oid | ) |
Remove a single matching document from this collection.
oid | a document oid. |
Definition at line 135 of file Collection.cpp.
void knowrob::mongo::Collection::removeOne | ( | const bson_oid_t & | oid | ) |
Remove a single matching document from this collection.
oid | a document oid. |
void Collection::removeOne | ( | const Document & | document | ) |
Remove a single matching document from this collection.
document | a document pattern. |
Definition at line 139 of file Collection.cpp.
void knowrob::mongo::Collection::removeOne | ( | const Document & | document | ) |
Remove a single matching document from this collection.
document | a document pattern. |
mongoc_client_session_t * Collection::session | ( | ) |
Definition at line 64 of file Collection.cpp.
mongoc_client_session_t* knowrob::mongo::Collection::session | ( | ) |
void Collection::storeOne | ( | const Document & | document | ) |
Store one document into this collection.
document | a JSON document. |
Definition at line 119 of file Collection.cpp.
void knowrob::mongo::Collection::storeOne | ( | const Document & | document | ) |
Store one document into this collection.
document | a JSON document. |
Update all existing documents matching the document pattern.
query | a document pattern. |
update | the update document. |
upsert | if true, create a new document if no match is found. |
Definition at line 156 of file Collection.cpp.
void knowrob::mongo::Collection::update | ( | const Document & | query, |
const Document & | update, | ||
bool | upsert = false |
||
) |
Update all existing documents matching the document pattern.
query | a document pattern. |
update | the update document. |
upsert | if true, create a new document if no match is found. |