summaryrefslogtreecommitdiff
path: root/dbtests/updatetests.cpp
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-03-24 18:42:51 -0400
committerAaron <aaron@10gen.com>2009-03-24 18:42:51 -0400
commit47340a0a9b7ee5787dd22392837a37cd2e9f652a (patch)
treecfd586e109fbbb1f2ebc381c03b1008d1675c04d /dbtests/updatetests.cpp
parentb850675fa9126ef25c89640b12685109517ea1cd (diff)
downloadmongo-47340a0a9b7ee5787dd22392837a37cd2e9f652a.tar.gz
$push checkpoint
Diffstat (limited to 'dbtests/updatetests.cpp')
-rw-r--r--dbtests/updatetests.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/dbtests/updatetests.cpp b/dbtests/updatetests.cpp
index 3a64a6039f7..d82ea301229 100644
--- a/dbtests/updatetests.cpp
+++ b/dbtests/updatetests.cpp
@@ -310,6 +310,33 @@ namespace UpdateTests {
}
};
+ class PushInvalidEltType : public SetBase {
+ public:
+ void run() {
+ client().insert( ns(), fromjson( "{'_id':0,a:1}" ) );
+ client().update( ns(), Query(), BSON( "$push" << BSON( "a" << 5 ) ) );
+ ASSERT( client().findOne( ns(), Query() ).woCompare( fromjson( "{'_id':0,a:1}" ) ) == 0 );
+ }
+ };
+
+ class PushConflictsWithOtherMod : public SetBase {
+ public:
+ void run() {
+ client().insert( ns(), fromjson( "{'_id':0,a:[1]}" ) );
+ client().update( ns(), Query(), BSON( "$set" << BSON( "a" << 1 ) <<"$push" << BSON( "a" << 5 ) ) );
+ ASSERT( client().findOne( ns(), Query() ).woCompare( fromjson( "{'_id':0,a:[1]}" ) ) == 0 );
+ }
+ };
+
+ class PushFromNothing : public SetBase {
+ public:
+ void run() {
+ client().insert( ns(), fromjson( "{'_id':0}" ) );
+ client().update( ns(), Query(), BSON( "$push" << BSON( "a" << 5 ) ) );
+ ASSERT( client().findOne( ns(), Query() ).woCompare( fromjson( "{'_id':0,a:[5]}" ) ) == 0 );
+ }
+ };
+
class All : public UnitTest::Suite {
public:
All() {
@@ -341,6 +368,9 @@ namespace UpdateTests {
add< InvalidEmbeddedSet >();
add< UpsertMissingEmbedded >();
add< Push >();
+ add< PushInvalidEltType >();
+ add< PushConflictsWithOtherMod >();
+ add< PushFromNothing >();
}
};