summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2008-07-31 22:21:32 -0400
committerEliot Horowitz <eliot@10gen.com>2008-07-31 22:21:32 -0400
commit9d5178583fdfedfb0b20c552688393493190fd72 (patch)
tree4ad621fa4ff1ca87443707aa45f68c2fc1a61c95
parent234844724cfeb7635073d08e5229bcb521d961e2 (diff)
downloadmongo-9d5178583fdfedfb0b20c552688393493190fd72.tar.gz
added type Symbol
-rw-r--r--db/jsobj.cpp5
-rw-r--r--db/jsobj.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/db/jsobj.cpp b/db/jsobj.cpp
index 51b8336f01e..86c05ec7c1f 100644
--- a/db/jsobj.cpp
+++ b/db/jsobj.cpp
@@ -145,6 +145,7 @@ string Element::toString() {
s << valuestr();
}
break;
+ case Symbol:
case String:
s << fieldName() << ": ";
if( valuestrsize() > 80 )
@@ -193,6 +194,7 @@ int Element::size() const {
case jstOID:
x = 13;
break;
+ case Symbol:
case Code:
case String:
x = valuestrsize() + 4 + 1;
@@ -263,6 +265,7 @@ int compareElementValues(const Element& l, const Element& r) {
case jstOID:
return memcmp(l.value(), r.value(), 12);
case Code:
+ case Symbol:
case String:
/* todo: utf version */
return strcmp(l.valuestr(), r.valuestr());
@@ -542,7 +545,7 @@ extern int dump;
inline bool _regexMatches(RegexMatcher& rm, Element& e) {
char buf[64];
const char *p = buf;
- if( e.type() == String )
+ if( e.type() == String || e.type() == Symbol )
p = e.valuestr();
else if( e.type() == Number ) {
sprintf(buf, "%f", e.number());
diff --git a/db/jsobj.h b/db/jsobj.h
index 74e39fc9f69..f3f816d8ce1 100644
--- a/db/jsobj.h
+++ b/db/jsobj.h
@@ -37,7 +37,7 @@ class JSObjBuilder;
*/
enum JSType { EOO = 0, Number=1, String=2, Object=3, Array=4, BinData=5,
Undefined=6, jstOID=7, Bool=8, Date=9 , jstNULL=10, RegEx=11 ,
- DBRef=12, Code=13, JSTypeMax=13, MaxKey=127 };
+ DBRef=12, Code=13, Symbol=14, JSTypeMax=14, MaxKey=127 };
/* subtypes of BinData.
bdtCustom and above are ones that the JS compiler understands, but are