summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-05-27 00:49:47 -0400
committerdwight <dwight@10gen.com>2011-05-27 00:49:47 -0400
commit284af81234941890b9ba06072886d1f248df4aaf (patch)
tree1330beff5ba30a1210722d9408be69228ad333a9 /shell
parentc775f5f250f9daa9bad803f738a5f6f351f4ca15 (diff)
downloadmongo-284af81234941890b9ba06072886d1f248df4aaf.tar.gz
shell bindata stuff
Diffstat (limited to 'shell')
-rw-r--r--shell/mongo_vstudio.cpp12
-rw-r--r--shell/msvc/mongo.vcxproj1
-rw-r--r--shell/msvc/mongo.vcxproj.filters3
-rw-r--r--shell/utils.js24
4 files changed, 22 insertions, 18 deletions
diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp
index 5747e8e451c..393f5ee7ad8 100644
--- a/shell/mongo_vstudio.cpp
+++ b/shell/mongo_vstudio.cpp
@@ -14,10 +14,8 @@ const StringData _jscode_raw_utils =
"friendlyEqual = function( a , b ){\n"
"if ( a == b )\n"
"return true;\n"
-"\n"
"if ( tojson( a ) == tojson( b ) )\n"
"return true;\n"
-"\n"
"return false;\n"
"}\n"
"\n"
@@ -40,10 +38,8 @@ const StringData _jscode_raw_utils =
"\n"
"assert = function( b , msg ){\n"
"if ( assert._debug && msg ) print( \"in assert for: \" + msg );\n"
-"\n"
"if ( b )\n"
"return;\n"
-"\n"
"doassert( msg == undefined ? \"assert failed\" : \"assert failed : \" + msg );\n"
"}\n"
"\n"
@@ -543,11 +539,11 @@ const StringData _jscode_raw_utils =
"print( \"warning: no BinData class\" );\n"
"}\n"
"\n"
-"if ( typeof( UUID ) != \"undefined\" ){\n"
+"/*if ( typeof( UUID ) != \"undefined\" ){\n"
"UUID.prototype.tojson = function () {\n"
"return this.toString();\n"
"}\n"
-"}\n"
+"}*/\n"
"\n"
"if ( typeof _threadInject != \"undefined\" ){\n"
"print( \"fork() available!\" );\n"
@@ -1492,6 +1488,10 @@ const StringData _jscode_raw_utils =
"print(\"\\tb.base64() the data as a base 64 encoded string\");\n"
"print(\"\\tb.toString()\");\n"
"print();\n"
+"print(\"\\tb = HexData(subtype,hexstr) create a BSON BinData value from a hex string\");\n"
+"print(\"\\tb = UUID(hexstr) create a BSON BinData value of UUID subtype\");\n"
+"print(\"\\tb = MD5(hexstr) create a BSON BinData value of MD5 subtype\");\n"
+"print();\n"
"print(\"\\to = new ObjectId() create a new ObjectId\");\n"
"print(\"\\to.getTimestamp() return timestamp derived from first 32 bits of the OID\");\n"
"print(\"\\to.isObjectId()\");\n"
diff --git a/shell/msvc/mongo.vcxproj b/shell/msvc/mongo.vcxproj
index aa25d64c1f3..c1381b373a7 100644
--- a/shell/msvc/mongo.vcxproj
+++ b/shell/msvc/mongo.vcxproj
@@ -121,6 +121,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\util\background.cpp" />
+ <ClCompile Include="..\..\util\concurrency\spin_lock.cpp" />
<ClCompile Include="..\..\util\log.cpp" />
<ClCompile Include="..\..\util\mmap.cpp" />
<ClCompile Include="..\..\util\password.cpp" />
diff --git a/shell/msvc/mongo.vcxproj.filters b/shell/msvc/mongo.vcxproj.filters
index ff054fbaf5d..112df791c53 100644
--- a/shell/msvc/mongo.vcxproj.filters
+++ b/shell/msvc/mongo.vcxproj.filters
@@ -231,6 +231,9 @@
<ClCompile Include="..\..\third_party\linenoise\linenoise.cpp">
<Filter>thirdparty</Filter>
</ClCompile>
+ <ClCompile Include="..\..\util\concurrency\spin_lock.cpp">
+ <Filter>util\concurrency</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\SConstruct" />
diff --git a/shell/utils.js b/shell/utils.js
index dd610dcaea2..a6311ce9a1e 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -9,10 +9,8 @@ chatty = function(s){
friendlyEqual = function( a , b ){
if ( a == b )
return true;
-
if ( tojson( a ) == tojson( b ) )
return true;
-
return false;
}
@@ -35,10 +33,8 @@ doassert = function (msg) {
assert = function( b , msg ){
if ( assert._debug && msg ) print( "in assert for: " + msg );
-
if ( b )
- return;
-
+ return;
doassert( msg == undefined ? "assert failed" : "assert failed : " + msg );
}
@@ -538,11 +534,11 @@ else {
print( "warning: no BinData class" );
}
-if ( typeof( UUID ) != "undefined" ){
+/*if ( typeof( UUID ) != "undefined" ){
UUID.prototype.tojson = function () {
return this.toString();
}
-}
+}*/
if ( typeof _threadInject != "undefined" ){
print( "fork() available!" );
@@ -1479,14 +1475,18 @@ help = shellHelper.help = function (x) {
print("beginning with '...' characters. Type the rest of your expression. Press Ctrl-C to abort the data entry if you");
print("get stuck.\n");
}
- else if (x == "misc") {
- print("\tb = new BinData(subtype,base64str) create a BSON BinData value");
+ else if (x == "misc") {
+ print("\tb = new BinData(subtype,base64str) create a BSON BinData value");
print("\tb.subtype() the BinData subtype (0..255)");
print("\tb.length() length of the BinData data in bytes");
print("\tb.hex() the data as a hex encoded string");
print("\tb.base64() the data as a base 64 encoded string");
- print("\tb.toString()");
- print();
+ print("\tb.toString()");
+ print();
+ print("\tb = HexData(subtype,hexstr) create a BSON BinData value from a hex string");
+ print("\tb = UUID(hexstr) create a BSON BinData value of UUID subtype");
+ print("\tb = MD5(hexstr) create a BSON BinData value of MD5 subtype");
+ print();
print("\to = new ObjectId() create a new ObjectId");
print("\to.getTimestamp() return timestamp derived from first 32 bits of the OID");
print("\to.isObjectId()");
@@ -1546,4 +1546,4 @@ help = shellHelper.help = function (x) {
}
else
print("unknown help option");
-}
+}