MongoType
MongoDB Collection Data Dump with BSON Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BSONTypeMap.cpp
Go to the documentation of this file.
1 
28 //----------------------------------------------------------------------------
29 
30 #include "mongotype.hpp"
31 #include "BSONTypeMap.hpp"
32 
33 //----------------------------------------------------------------------------
34 
35 namespace mongotype {
36 
37 //----------------------------------------------------------------------------
38 
44  make_pair(MinKey, BSONTypeElement("MinKey", "MinKey")),
45  make_pair(EOO, BSONTypeElement("EOO", "EOO")),
46  make_pair(NumberDouble, BSONTypeElement("NumberDouble", "Double")),
47  make_pair(String, BSONTypeElement("String", "UTF8")),
48  make_pair(Object, BSONTypeElement("Object", "BSON")),
49  make_pair(Array, BSONTypeElement("Array", "BSON Array")),
50  make_pair(BinData, BSONTypeElement("BinData", "Binary")),
51  make_pair(Undefined, BSONTypeElement("Undefined", "Undefined")),
52  make_pair(jstOID, BSONTypeElement("jstOID", "ObjectId")),
53  make_pair(Bool, BSONTypeElement("Bool", "Boolean")),
54  make_pair(Date, BSONTypeElement("Date", "Date")),
55  make_pair(jstNULL, BSONTypeElement("jstNULL", "NULL")),
56  make_pair(RegEx, BSONTypeElement("RegEx", "Regex")),
57  make_pair(DBRef, BSONTypeElement("DBRef", "deprecated")),
58  make_pair(Code, BSONTypeElement("Code", "deprecated")),
59  make_pair(Symbol, BSONTypeElement("Symbol", "Symbol")),
60  make_pair(CodeWScope, BSONTypeElement("CodeWScope", "Javascript")),
61  make_pair(NumberInt, BSONTypeElement("NumberInt", "int32")),
62  make_pair(Timestamp, BSONTypeElement("Timestamp", "Timestamp")),
63  make_pair(NumberLong, BSONTypeElement("NumberLong", "int64")),
64  make_pair(JSTypeMax, BSONTypeElement("JSTypeMax", "Max Object Value Used")),
65  make_pair(MaxKey, BSONTypeElement("MaxKey", "MaxKey"))
66 };
67 
68 //----------------------------------------------------------------------------
69 
76 const BSONTypeElement& BSONTypeMap::lookup(BSONType type) {
77  try {
78  const BSONTypeElement& rv = BSONTypeLookupTable.at(type);
79  return rv;
80  } catch (out_of_range& oor) {
81  static const BSONTypeElement& unk = BSONTypeElement("UNKNOWN", "UNKNOWN");
82  return unk;
83  }
84 }
85 
86 //----------------------------------------------------------------------------
87 
88 } /* namespace mongotype */