Class MongoMessageCollection

Inheritance Relationships

Base Type

  • public warehouse_ros::MessageCollectionHelper

Class Documentation

class MongoMessageCollection : public warehouse_ros::MessageCollectionHelper

Public Functions

MongoMessageCollection(const std::shared_ptr<mongo::DBClientConnection> &conn, const std::string &db_name, const std::string &collection_name)
bool initialize(const std::string &datatype, const std::string &md5)
void ensureIndex(const std::string &field)
Post:

Ensure that there’s an index on the given field. Note that index on _id and creation_time are always created.

void insert(char *msg, size_t msg_size, Metadata::ConstPtr metadata)

Insert a ROS message, together with some optional metadata, into the db.

Throws:

mongo::DBException – if unable to insert

ResultIteratorHelper::Ptr query(Query::ConstPtr query, const std::string &sort_by, bool ascending) const
Return values:

Iterator – range over matching messages

Parameters:
  • query – A metadata object representing a query.

  • metadata_only – If this is true, only retrieve the metadata (returned message objects will just be default constructed)

unsigned removeMessages(Query::ConstPtr query)

Remove messages matching query.

void modifyMetadata(Query::ConstPtr q, Metadata::ConstPtr m)

Modify metadata Find message matching q and update its metadata using m In other words, overwrite keys in the message using m, but keep keys that don’t occur in m.

unsigned count()

Count messages in collection.

std::string collectionName() const

Return name of collection.

inline Query::Ptr createQuery() const
inline Metadata::Ptr createMetadata() const