-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 1.6.5
-
Component/s: JavaScript
-
None
-
Environment:OSX, MongoDB 1.6.5, although I imagine it's a cross platform bug
-
Fully Compatible
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Steps to reproduce in the shell:
db.bug.save({toString : {} });
db.bug.find();
Resulting error message: "TypeError: x.toString is not a function"
You don't get any results and the only way to fix it in the shell is either db.bug.remove(); or db.bug.drop();
I know it's a stupid object to save, but a bug in my code saved an object with {toString : {} } and I ran into this.
Throw this in there:
(typeof(x.toString) === 'function') ? x.toString() : x
Thanks.