db_mongoc.h File Reference

Simple wrappers of the API of MongoDB C driver mongo-c-driver, see MongoDB C Driver for more information. More...

#include <vector>
#include <map>
#include <iostream>
#include <mongoc.h>
#include "basic.h"

Go to the source code of this file.

Classes

class  ccgl::db_mongoc::MongoClient
 A simple wrapper of the class of MongoDB Client mongoc_client_t. More...
 
class  ccgl::db_mongoc::MongoDatabase
 A simple wrapper of the class of MongoDB database mongoc_database_t. More...
 
class  ccgl::db_mongoc::MongoCollection
 A simple wrapper of the class of MongoDB Collection mongoc_collection_t. More...
 
class  ccgl::db_mongoc::MongoGridFs
 A simple wrapper of the class of MongoDB database mongoc_gridfs_t. More...
 

Namespaces

namespace  ccgl
 Common Cross-platform Geographic Library (CCGL)
 
namespace  ccgl::db_mongoc
 Simple wrappers of the API of MongoDB C driver mongo-c-driver, see MongoDB C Driver for more information.
 

Functions

void ccgl::db_mongoc::AppendStringOptionsToBson (bson_t *bson_opts, const STRING_MAP &opts, const string &prefix=string())
 Append options to bson_t More...
 
template<typename T >
bool ccgl::db_mongoc::GetNumericFromBsonIterator (bson_iter_t *iter, T &numericvalue)
 Get numeric value from the iterator (bson_iter_t) of bson_taccording to a given key. More...
 
template<typename T >
bool ccgl::db_mongoc::GetNumericFromBson (bson_t *bmeta, const char *key, T &numericvalue)
 Get numeric value from bson_t according to a given key. More...
 
string ccgl::db_mongoc::GetStringFromBsonIterator (bson_iter_t *iter)
 Get String from the iterator (bson_iter_t) of bson_t More...
 
string ccgl::db_mongoc::GetStringFromBson (bson_t *bmeta, const char *key)
 Get String from bson_t More...
 
bool ccgl::db_mongoc::GetBoolFromBsonIterator (bson_iter_t *iter)
 Get Bool from the iterator (bson_iter_t) of bson_t More...
 
bool ccgl::db_mongoc::GetBoolFromBson (bson_t *bmeta, const char *key)
 Get String from bson_t More...
 
time_t ccgl::db_mongoc::GetDatetimeFromBsonIterator (bson_iter_t *iter)
 Get Datetime from the iterator (bson_iter_t) of bson_t More...
 
time_t ccgl::db_mongoc::GetDatetimeFromBson (bson_t *bmeta, const char *key)
 Get Datetime from bson_t More...
 

Detailed Description

Simple wrappers of the API of MongoDB C driver mongo-c-driver, see MongoDB C Driver for more information.

Remarks
  • 1. 2017-12-02 - lj - Add unittest based on gtest/gmock.
  • 2. 2018-05-02 - lj - Make part of CCGL.
  • 3. 2019-08-16 - lj - Simplify brief desc. and move detail desc. to implementation.
Note
No exceptions will be thrown.
Author
Liangjun Zhu, zlj(at)lreis.ac.cn
Version
1.2