MongoDB  2.7.0
Public Member Functions | List of all members
mongo::BSONArray Struct Reference
Inheritance diagram for mongo::BSONArray:
mongo::BSONObj

Public Member Functions

 BSONArray (const BSONObj &obj)
 
- Public Member Functions inherited from mongo::BSONObj
 BSONObj (const char *msgdata)
 Construct a BSONObj from data in the proper format. More...
 
 BSONObj (Holder *holder)
 
 BSONObj ()
 Construct an empty BSONObj – that is, {}. More...
 
bool isOwned () const
 A BSONObj can use a buffer it "owns" or one it does not. More...
 
BSONObj getOwned () const
 assure the data buffer is under the control of this BSONObj and not a remote buffer More...
 
BSONObj copy () const
 
std::string toString (bool isArray=false, bool full=false) const
 
void toString (StringBuilder &s, bool isArray=false, bool full=false, int depth=0) const
 
std::string jsonString (JsonStringFormat format=Strict, int pretty=0) const
 Properly formatted JSON string. More...
 
int addFields (BSONObj &from, std::set< std::string > &fields)
 note: addFields always adds _id even if not specified
 
BSONObj removeField (const StringData &name) const
 remove specified field and return a new object with the remaining fields. More...
 
int nFields () const
 returns # of top level fields in the object note: iterates to count the fields
 
int getFieldNames (std::set< std::string > &fields) const
 adds the field names to the fields set. More...
 
BSONElement getFieldDotted (const StringData &name) const
 
void getFieldsDotted (const StringData &name, BSONElementSet &ret, bool expandLastArray=true) const
 Like getFieldDotted(), but expands arrays and returns all matching objects. More...
 
void getFieldsDotted (const StringData &name, BSONElementMSet &ret, bool expandLastArray=true) const
 
BSONElement getFieldDottedOrArray (const char *&name) const
 Like getFieldDotted(), but returns first array encountered while traversing the dotted fields of name. More...
 
BSONElement getField (const StringData &name) const
 Get the field of the specified name. More...
 
void getFields (unsigned n, const char **fieldNames, BSONElement *fields) const
 Get several fields at once. More...
 
BSONElement operator[] (const StringData &field) const
 Get the field of the specified name. More...
 
BSONElement operator[] (int field) const
 
bool hasField (const StringData &name) const
 
bool hasElement (const StringData &name) const
 
const char * getStringField (const StringData &name) const
 
BSONObj getObjectField (const StringData &name) const
 
int getIntField (const StringData &name) const
 
bool getBoolField (const StringData &name) const
 
BSONObj extractFieldsUnDotted (const BSONObj &pattern) const
 
BSONObj extractFields (const BSONObj &pattern, bool fillWithNull=false) const
 extract items from object which match a pattern object. More...
 
BSONObj filterFieldsUndotted (const BSONObj &filter, bool inFilter) const
 
BSONElement getFieldUsingIndexNames (const StringData &fieldName, const BSONObj &indexKey) const
 
bool couldBeArray () const
 arrays are bson objects with numeric and increasing field names More...
 
const char * objdata () const
 
int objsize () const
 
bool isValid () const
 performs a cursory check on the object's size only. More...
 
bool okForStorage () const
 
bool okForStorageAsRoot () const
 Same as above with the following extra restrictions Not valid if: More...
 
Status storageValidEmbedded (const bool deep=true) const
 Validates that this can be stored as an embedded document See details above in okForStorage. More...
 
Status storageValid (const bool deep=true) const
 Validates that this can be stored as a document (in a collection) See details above in okForStorageAsRoot. More...
 
bool isEmpty () const
 
void dump () const
 
std::string hexDump () const
 Alternative output format.
 
int woCompare (const BSONObj &r, const Ordering &o, bool considerFieldName=true) const
 wo='well ordered'. More...
 
int woCompare (const BSONObj &r, const BSONObj &ordering=BSONObj(), bool considerFieldName=true) const
 wo='well ordered'. More...
 
bool operator< (const BSONObj &other) const
 
bool operator<= (const BSONObj &other) const
 
bool operator> (const BSONObj &other) const
 
bool operator>= (const BSONObj &other) const
 
int woSortOrder (const BSONObj &r, const BSONObj &sortKey, bool useDotted=false) const
 
bool equal (const BSONObj &r) const
 
bool isPrefixOf (const BSONObj &otherObj) const
 
bool isFieldNamePrefixOf (const BSONObj &otherObj) const
 
bool binaryEqual (const BSONObj &r) const
 This is "shallow equality" – ints and doubles won't match. More...
 
BSONElement firstElement () const
 
const char * firstElementFieldName () const
 faster than firstElement().fieldName() - for the first element we can easily find the fieldname without computing the element size.
 
BSONType firstElementType () const
 
bool getObjectID (BSONElement &e) const
 Get the _id field from the object. More...
 
int hash () const
 
BSONObj clientReadable () const
 
BSONObj replaceFieldNames (const BSONObj &obj) const
 Return new object with the field names replaced by those in the passed object. More...
 
bool valid () const
 true unless corrupt
 
std::string md5 () const
 
bool operator== (const BSONObj &other) const
 
bool operator!= (const BSONObj &other) const
 
void elems (std::vector< BSONElement > &) const
 add all elements of the object to the specified vector
 
void elems (std::list< BSONElement > &) const
 add all elements of the object to the specified list
 
template<class T >
void Vals (std::vector< T > &) const
 add all values of the object to the specified vector. More...
 
template<class T >
void Vals (std::list< T > &) const
 add all values of the object to the specified list. More...
 
template<class T >
void vals (std::vector< T > &) const
 add all values of the object to the specified vector. More...
 
template<class T >
void vals (std::list< T > &) const
 add all values of the object to the specified list. More...
 
BSONObjIterator begin () const
 use something like this: for( BSONObj::iterator i = myObj.begin(); i.more(); ) { BSONElement e = i.next(); ... More...
 
void appendSelfToBufBuilder (BufBuilder &b) const
 
template<typename T >
bool coerceVector (std::vector< T > *out) const
 
 BSONObj (const BSONObj &rO)
 
BSONObjoperator= (const BSONObj &rRHS)
 
void serializeForSorter (BufBuilder &buf) const
 
int memUsageForSorter () const
 

Additional Inherited Members

- Public Types inherited from mongo::BSONObj
enum  { maxToStringRecursionDepth = 100 }
 Readable representation of a BSON object in an extended JSON-style notation. More...
 
enum  MatchType {
  Equality = 0, LT = 0x1, LTE = 0x3, GTE = 0x6,
  GT = 0x4, opIN = 0x8, NE = 0x9, opSIZE = 0x0A,
  opALL = 0x0B, NIN = 0x0C, opEXISTS = 0x0D, opMOD = 0x0E,
  opTYPE = 0x0F, opREGEX = 0x10, opOPTIONS = 0x11, opELEM_MATCH = 0x12,
  opNEAR = 0x13, opWITHIN = 0x14, opMAX_DISTANCE = 0x15, opGEO_INTERSECTS = 0x16
}
 
typedef BSONObjIterator iterator
 
- Static Public Member Functions inherited from mongo::BSONObj
static BSONObj deserializeForSorter (BufReader &buf, const SorterDeserializeSettings &)
 

The documentation for this struct was generated from the following file: