summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2013-02-24 06:32:04 -0500
committerTad Marshall <tad@10gen.com>2013-02-26 13:44:31 -0500
commit7e7866cc263c2af803ba2479b212c245f73d57bc (patch)
treea3e6118097b5a166ee290d47e368aea6fb3a284a
parent56a415f2adc9601dfc9b06e532acaa74a3c2d59c (diff)
downloadmongo-7e7866cc263c2af803ba2479b212c245f73d57bc.tar.gz
SERVER-8693 Do not try to reference JSON in autocomplete
-rw-r--r--src/mongo/shell/utils.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 6fafe4b54d4..c00a7aaf6ff 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -571,7 +571,9 @@ shellAutocomplete = function ( /*prefix*/ ) { // outer scope function called on
builtinMethods[Array] = "length concat join pop push reverse shift slice sort splice unshift indexOf lastIndexOf every filter forEach map some isArray reduce reduceRight".split( ' ' );
builtinMethods[Boolean] = "".split( ' ' ); // nothing more than universal methods
builtinMethods[Date] = "getDate getDay getFullYear getHours getMilliseconds getMinutes getMonth getSeconds getTime getTimezoneOffset getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getYear parse setDate setFullYear setHours setMilliseconds setMinutes setMonth setSeconds setTime setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setYear toDateString toGMTString toISOString toLocaleDateString toLocaleTimeString toTimeString toUTCString UTC now".split( ' ' );
- builtinMethods[JSON] = "parse stringify".split(' ');
+ if (typeof JSON != "undefined") { // JSON is new in V8
+ builtinMethods["[object JSON]"] = "parse stringify".split(' ');
+ }
builtinMethods[Math] = "E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2 abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan".split(' ');
builtinMethods[Number] = "MAX_VALUE MIN_VALUE NEGATIVE_INFINITY POSITIVE_INFINITY toExponential toFixed toPrecision".split( ' ' );
builtinMethods[RegExp] = "global ignoreCase lastIndex multiline source compile exec test".split( ' ' );