Skip to content
Browse files

more test fixing

  • Loading branch information...
1 parent af54331 commit f63206fed40e42b567b60d9d421fdaa4d2578486 @erh erh committed Jan 21, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −1 jstests/error5.js
  2. +3 −0 shell/collection.js
  3. +3 −0 shell/mongo_vstudio.cpp
View
2 jstests/error5.js
@@ -2,7 +2,7 @@
t = db.error5
t.drop();
-assert.throws( function(){ t.save( 4 ); } , null , "A" );
+assert.throws( function(){ t.save( 4 ); printjson( t.findOne() ) } , null , "A" );
t.save( { a : 1 } )
assert.eq( 1 , t.count() , "B" );
View
3 shell/collection.js
@@ -203,6 +203,9 @@ DBCollection.prototype.save = function( obj ){
if ( obj == null || typeof( obj ) == "undefined" )
throw "can't save a null";
+ if ( typeof( obj ) == "number" || typeof( obj) == "string" )
+ throw "can't save a number or string"
+
if ( typeof( obj._id ) == "undefined" ){
obj._id = new ObjectId();
return this.insert( obj );
View
3 shell/mongo_vstudio.cpp
@@ -2973,6 +2973,9 @@ const StringData _jscode_raw_collection =
"if ( obj == null || typeof( obj ) == \"undefined\" )\n"
"throw \"can't save a null\";\n"
"\n"
+"if ( typeof( obj ) == \"number\" || typeof( obj) == \"string\" )\n"
+"throw \"can't save a number or string\"\n"
+"\n"
"if ( typeof( obj._id ) == \"undefined\" ){\n"
"obj._id = new ObjectId();\n"
"return this.insert( obj );\n"

0 comments on commit f63206f

Please sign in to comment.
Something went wrong with that request. Please try again.