summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-06-18 13:34:01 -0400
committerDwight <dmerriman@gmail.com>2009-06-18 13:34:01 -0400
commit64e8052961075def22e2f6feacf4c462d358c099 (patch)
tree68133645724242f68d860de84b180bbba4bc61e1
parentf136b4b850ae992b640e21daf3edb4f5a71d8de9 (diff)
downloadmongo-64e8052961075def22e2f6feacf4c462d358c099.tar.gz
update unique tests (pending)
-rw-r--r--jstests/indexa.js1
-rw-r--r--jstests/indexb.js31
2 files changed, 32 insertions, 0 deletions
diff --git a/jstests/indexa.js b/jstests/indexa.js
index 11a332374c9..ba46d2f67d8 100644
--- a/jstests/indexa.js
+++ b/jstests/indexa.js
@@ -15,5 +15,6 @@ t.update( {x:'B'}, { x:'A' } );
a = t.find().toArray();
u = a.map( function(z){ return z.x } ).unique();
+print("test commented out in indexa.js...");
//assert( a.length == u.length , "unique index update is broken" );
diff --git a/jstests/indexb.js b/jstests/indexb.js
new file mode 100644
index 00000000000..78f873e867c
--- /dev/null
+++ b/jstests/indexb.js
@@ -0,0 +1,31 @@
+// unique index test for a case where the object grows
+// and must move
+
+// see indexa.js for the test case for an update with dup id check
+// when it doesn't move
+
+
+t = db.indexb;t = db.indexb;
+db.dropDatabase();
+t.drop();
+t.ensureIndex({a:1},true);
+
+t.insert({a:1});
+
+x = { a : 2 };
+t.save(x);
+
+print("test commented out indexb.js");
+if( 0 ) {
+
+assert( t.count() == 2, "count wrong B");
+
+x.a = 1;
+x.filler = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+t.save(x); // should fail, not unique.
+
+assert( t.count() == 2,"count wrong" );
+assert( t.find({a:1}).count() == 1,"bfail1" );
+assert( t.find({a:2}).count() == 1,"bfail2" );
+
+}