summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authoragirbal <antoine@10gen.com>2011-07-02 16:00:35 -0700
committeragirbal <antoine@10gen.com>2011-07-02 16:01:48 -0700
commiteb5c2318c7c953d81386f73489afd59d90e49083 (patch)
treec4742fd30e345ceb60dc20fb77845d50987507c5 /shell
parent085ce764570c06eb5589ca0c4a0a7ec5d2f9683e (diff)
downloadmongo-eb5c2318c7c953d81386f73489afd59d90e49083.tar.gz
SERVER-854: implementation of NumberInt for V8
Diffstat (limited to 'shell')
-rw-r--r--shell/mongo_vstudio.cpp9
-rw-r--r--shell/utils.js9
2 files changed, 16 insertions, 2 deletions
diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp
index 5a9687f8fb1..6100315c479 100644
--- a/shell/mongo_vstudio.cpp
+++ b/shell/mongo_vstudio.cpp
@@ -460,6 +460,14 @@ const StringData _jscode_raw_utils =
"return this.toString();\n"
"}\n"
"\n"
+"if ( ! NumberInt.prototype ) {\n"
+"NumberInt.prototype = {}\n"
+"}\n"
+"\n"
+"NumberInt.prototype.tojson = function() {\n"
+"return this.toString();\n"
+"}\n"
+"\n"
"if ( ! ObjectId.prototype )\n"
"ObjectId.prototype = {}\n"
"\n"
@@ -967,7 +975,6 @@ const StringData _jscode_raw_utils =
"\n"
"builtinMethods[Mongo] = \"find update insert remove\".split(' ');\n"
"builtinMethods[BinData] = \"hex base64 length subtype\".split(' ');\n"
-"builtinMethods[NumberLong] = \"toNumber\".split(' ');\n"
"\n"
"var extraGlobals = \"Infinity NaN undefined null true false decodeURI decodeURIComponent encodeURI encodeURIComponent escape eval isFinite isNaN parseFloat parseInt unescape Array Boolean Date Math Number RegExp String print load gc MinKey MaxKey Mongo NumberLong ObjectId DBPointer UUID BinData Map\".split(' ');\n"
"\n"
diff --git a/shell/utils.js b/shell/utils.js
index dba68a343d6..d27c29f8b51 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -455,6 +455,14 @@ NumberLong.prototype.tojson = function() {
return this.toString();
}
+if ( ! NumberInt.prototype ) {
+ NumberInt.prototype = {}
+}
+
+NumberInt.prototype.tojson = function() {
+ return this.toString();
+}
+
if ( ! ObjectId.prototype )
ObjectId.prototype = {}
@@ -962,7 +970,6 @@ shellAutocomplete = function (/*prefix*/){ // outer scope function called on ini
builtinMethods[Mongo] = "find update insert remove".split(' ');
builtinMethods[BinData] = "hex base64 length subtype".split(' ');
- builtinMethods[NumberLong] = "toNumber".split(' ');
var extraGlobals = "Infinity NaN undefined null true false decodeURI decodeURIComponent encodeURI encodeURIComponent escape eval isFinite isNaN parseFloat parseInt unescape Array Boolean Date Math Number RegExp String print load gc MinKey MaxKey Mongo NumberLong ObjectId DBPointer UUID BinData Map".split(' ');