summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/validate_tests.cpp
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2016-05-02 14:37:02 -0400
committerRobert Guo <robert.guo@10gen.com>2016-05-03 11:25:40 -0400
commit0be06e34e7bac8714558d6b28439e90363b452b1 (patch)
tree2bd18bbffc2e73c34f4321e74d4e13e6568fc65c /src/mongo/dbtests/validate_tests.cpp
parent6b3bc95404ff8a47fc340497f60edfb1b386631c (diff)
downloadmongo-0be06e34e7bac8714558d6b28439e90363b452b1.tar.gz
SERVER-24008 validate() should check index is partial before multikey
Diffstat (limited to 'src/mongo/dbtests/validate_tests.cpp')
-rw-r--r--src/mongo/dbtests/validate_tests.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index 1c32e715510..e1918c758de 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -448,7 +448,7 @@ public:
ValidatePartialIndex() : ValidateBase(true) {}
void run() {
- // Create a new collection, insert two records and check it's valid.
+ // Create a new collection, insert three records and check it's valid.
Database* db = _ctx.db();
OpDebug* const nullOpDebug = nullptr;
Collection* coll;
@@ -461,6 +461,13 @@ public:
ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), nullOpDebug, true));
id1 = coll->getCursor(&_txn)->next()->id;
ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), nullOpDebug, true));
+ // Explicitly test that multi-key partial indexes containing documents that
+ // don't match the filter expression are handled correctly.
+ ASSERT_OK(coll->insertDocument(
+ &_txn,
+ BSON("_id" << 3 << "a" << BSON_ARRAY(-1 << -2 << -3)),
+ nullOpDebug,
+ true));
wunit.commit();
}