SequoiaDB
 All Classes Namespaces Files Functions Macros Pages
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
bsonmisc.h File Reference

BSON macro. More...

#include "bsonnoncopyable.h"

Go to the source code of this file.

Classes

class  bson::BSONElementCmpWithoutField
 
class  bson::BSONObjCmp
 
struct  bson::GENOIDLabeler
 Utility class to auto assign object IDs. More...
 
struct  bson::DateNowLabeler
 
struct  bson::MinKeyLabeler
 
struct  bson::MaxKeyLabeler
 
class  bson::Labeler
 
struct  bson::Labeler::Label
 
class  bson::BSONObjBuilderValueStream
 
class  bson::BSONSizeTracker
 used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage More...
 

Namespaces

namespace  bson
 Include files for C++ BSON module.
 

Macros

#define BSON(x)   (( bson::BSONObjBuilder(64) << x ).obj())
 Use BSON macro to build a BSONObj from a stream.
 
#define BSON_ARRAY(x)   (( bson::BSONArrayBuilder() << x ).arr())
 Use BSON_ARRAY macro like BSON macro, but without keys.
 

Typedefs

typedef set< BSONObj, BSONObjCmp > bson::BSONObjSet
 

Enumerations

enum  FieldCompareResult {
  LEFT_SUBFIELD = -2, LEFT_BEFORE = -1, SAME = 0, RIGHT_BEFORE = 1,
  RIGHT_SUBFIELD = 2
}
 

Functions

int bson::getGtLtOp (const BSONElement &e)
 
FieldCompareResult bson::compareDottedFieldNames (const char *l, const char *r)
 
BSONObj bson::OR (const BSONObj &a, const BSONObj &b)
 
BSONObj bson::OR (const BSONObj &a, const BSONObj &b, const BSONObj &c)
 
BSONObj bson::OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d)
 
BSONObj bson::OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e)
 
BSONObj bson::OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e, const BSONObj &f)
 

Variables

struct bson::GENOIDLabeler bson::GENOID
 
struct bson::DateNowLabeler bson::DATENOW
 
struct bson::MinKeyLabeler bson::MINKEY
 
struct bson::MaxKeyLabeler bson::MAXKEY
 
Labeler::Label bson::GT
 
Labeler::Label bson::GTE
 
Labeler::Label bson::LT
 
Labeler::Label bson::LTE
 
Labeler::Label bson::NE
 
Labeler::Label bson::SIZE
 

Detailed Description

BSON macro.

Macro Definition Documentation

#define BSON (   x)    (( bson::BSONObjBuilder(64) << x ).obj())

Use BSON macro to build a BSONObj from a stream.

e.g., BSON( "name" << "joe" << "age" << 33 )

with auto-generated object id: BSON( GENOID << "name" << "joe" << "age" << 33 )

The labels GT, GTE, LT, LTE, NE can be helpful for stream-oriented construction of a BSONObj, particularly when assembling a Query. For example, BSON( "a" << GT << 23.4 << NE << 30 << "b" << 2 ) produces the object { a: { $gt: 23.4, $ne: 30 }, b: 2 }.

#define BSON_ARRAY (   x)    (( bson::BSONArrayBuilder() << x ).arr())

Use BSON_ARRAY macro like BSON macro, but without keys.

BSONArray arr = BSON_ARRAY( "hello" << 1 << BSON( "foo" << BSON_ARRAY( "bar" << "baz" << "qux" ) ) );