Details
-
Bug
-
Resolution: Done
-
Minor - P4
-
None
-
2.4.10, 2.6.1-rc1
-
None
-
ALL
Description
In earlier versions (tested 2.2.6), the mongo shell refused values (other than functions) for the field named "toString", as it would overwrite the internal method to print the document.
MongoDB shell version: 2.2.6
|
connecting to: test
|
> a = {foo: "bar", toString: "test"}
|
Sun May 4 15:06:52 TypeError: x.toString is not a function src/mongo/shell/utils.js:1027
|
This is no longer validated in 2.4.x and 2.6.x
MongoDB shell version: 2.4.9
|
connecting to: test
|
> a = {foo: "bar", toString: "test"}
|
[object]
|
> a
|
[object]
|
MongoDB shell version: 2.6.1-rc0
|
connecting to: test
|
> a = {foo: "bar", toString: "test"}
|
[object]
|
> a
|
[object]
|
These documents are displayed with [object] in the shell. This is confusing to users who are not aware of the issue, and also outputs invalid JSON.