diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-05-26 14:43:20 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-05-26 14:43:20 -0400 |
commit | c0fef5d2abdc049554f410bdfc5f87bd834dd771 (patch) | |
tree | fcd93429a0bc4a58944b0b27ebe42cd71d1f57b7 /dbtests | |
parent | c7c389007915217d14e3395e341dceb8c8d2808d (diff) | |
download | mongo-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.cpp | 29 |
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; } |