summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-05-26 14:43:20 -0400
committerEliot Horowitz <eliot@10gen.com>2009-05-26 14:43:20 -0400
commitc0fef5d2abdc049554f410bdfc5f87bd834dd771 (patch)
treefcd93429a0bc4a58944b0b27ebe42cd71d1f57b7 /dbtests
parentc7c389007915217d14e3395e341dceb8c8d2808d (diff)
downloadmongo-c0fef5d2abdc049554f410bdfc5f87bd834dd771.tar.gz
don't translate sm -> bson if object hasn't been modified
SERVER-70
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/jstests.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/dbtests/jstests.cpp b/dbtests/jstests.cpp
index 8440b2e712c..9a1c9de2345 100644
--- a/dbtests/jstests.cpp
+++ b/dbtests/jstests.cpp
@@ -359,8 +359,37 @@ namespace JSTests {
ASSERT_EQUALS( NumberDouble , out["b"].type() );
ASSERT_EQUALS( NumberInt , out["a"].type() );
+
+ // -- C --
+ {
+ BSONObjBuilder b ;
+
+ {
+ BSONObjBuilder c;
+ c.append( "0" , 5.5 );
+ c.append( "1" , 6 );
+ b.appendArray( "a" , c.obj() );
+ }
+
+ o = b.obj();
+ }
+
+ ASSERT_EQUALS( NumberDouble , o["a"].embeddedObjectUserCheck()["0"].type() );
+ ASSERT_EQUALS( NumberInt , o["a"].embeddedObjectUserCheck()["1"].type() );
+
+ s->setObject( "z" , o , false );
+ out = s->getObject( "z" );
+
+ ASSERT_EQUALS( NumberDouble , out["a"].embeddedObjectUserCheck()["0"].type() );
+ ASSERT_EQUALS( NumberInt , out["a"].embeddedObjectUserCheck()["1"].type() );
+
+ s->invokeSafe( "z.z = 5;" , BSONObj() );
+ out = s->getObject( "z" );
+ ASSERT_EQUALS( 5 , out["z"].number() );
+ ASSERT_EQUALS( NumberDouble , out["a"].embeddedObjectUserCheck()["0"].type() );
+ ASSERT_EQUALS( NumberDouble , out["a"].embeddedObjectUserCheck()["1"].type() ); // TODO: this is technically bad, but here to make sure that i understand the behavior
delete s;
}