summaryrefslogtreecommitdiff
path: root/jstests/auth/readIndex.js
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2014-10-09 19:17:04 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2014-10-13 16:55:55 -0400
commitdca807002b77347f9001ffc583ed25de659ce60f (patch)
tree3ebfa7c00db597e6c94df939a4c67e8afd53d10b /jstests/auth/readIndex.js
parent3400b0ef037c1b0a244740e95e0fa0dedd36c95e (diff)
downloadmongo-dca807002b77347f9001ffc583ed25de659ce60f.tar.gz
SERVER-15594 Make readIndex.js test storage engine independent.
Diffstat (limited to 'jstests/auth/readIndex.js')
-rw-r--r--jstests/auth/readIndex.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/jstests/auth/readIndex.js b/jstests/auth/readIndex.js
index 945fabe84a9..433a2e7eb1d 100644
--- a/jstests/auth/readIndex.js
+++ b/jstests/auth/readIndex.js
@@ -3,6 +3,7 @@ var conn = MongoRunner.runMongod({auth : ""});
var adminDB = conn.getDB("admin");
var testDB = conn.getDB("testdb");
+var indexName = 'idx_a';
adminDB.createUser({user:'root', pwd:'password', roles:['root']});
adminDB.auth('root', 'password');
@@ -11,9 +12,10 @@ testDB.createUser({user:'dbAdmin', pwd:'password', roles:['dbAdmin']});
adminDB.logout();
testDB.auth('dbAdmin', 'password');
-testDB.foo.ensureIndex({a:1});
-assert.eq(2, testDB.system.indexes.count()); // index on 'a' plus default _id index
-var indexDoc = testDB.system.indexes.findOne({key:{a:1}});
-printjson(indexDoc);
-assert.neq(null, indexDoc);
-assert.eq(2, testDB.system.indexes.stats().count); \ No newline at end of file
+testDB.foo.ensureIndex({a:1}, {name:indexName});
+assert.eq(2, testDB.foo.getIndexes().length); // index on 'a' plus default _id index
+var indexList = testDB.foo.getIndexes().filter(function(idx) {
+ return idx.name === indexName;
+});
+assert.eq(1, indexList.length, tojson(indexList));
+assert.docEq(indexList[0].key, {a:1}, tojson(indexList));