From d8e129c8ab3844903cd19ae565ab32faf0aadd59 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 22 May 2009 10:46:33 -0400 Subject: BUG SERVER-67 correctly handle insertion of new null element with $set --- dbtests/updatetests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dbtests') diff --git a/dbtests/updatetests.cpp b/dbtests/updatetests.cpp index 6c50b3b39d4..10beba793c0 100644 --- a/dbtests/updatetests.cpp +++ b/dbtests/updatetests.cpp @@ -456,6 +456,15 @@ namespace UpdateTests { } }; + class UpdateMissingToNull : public SetBase { + public: + void run() { + client().insert( ns(), BSON( "a" << 5 ) ); + client().update( ns(), BSON( "a" << 5 ), fromjson( "{$set:{b:null}}" ) ); + ASSERT_EQUALS( jstNULL, client().findOne( ns(), QUERY( "a" << 5 ) ).getField( "b" ).type() ); + } + }; + class All : public Suite { public: All() { @@ -503,6 +512,7 @@ namespace UpdateTests { add< ModParentOfIndex >(); add< PreserveIdWithIndex >(); add< CheckNoMods >(); + add< UpdateMissingToNull >(); } }; -- cgit v1.2.1