summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/repltests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests/repltests.cpp')
-rw-r--r--src/mongo/dbtests/repltests.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index f53a2545968..f01c2d88fef 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -152,37 +152,17 @@ protected:
return count;
}
int opCount() {
- ScopedTransaction transaction(&_txn, MODE_X);
- Lock::GlobalWrite lk(_txn.lockState());
- OldClientContext ctx(&_txn, cllNS());
-
- Database* db = ctx.db();
- Collection* coll = db->getCollection(cllNS());
- if (!coll) {
- WriteUnitOfWork wunit(&_txn);
- coll = db->createCollection(&_txn, cllNS());
- wunit.commit();
- }
-
- int count = 0;
- auto cursor = coll->getCursor(&_txn);
- while (auto record = cursor->next()) {
- ++count;
- }
- return count;
+ return DBDirectClient(&_txn).query(cllNS(), BSONObj())->itcount();
}
void applyAllOperations() {
ScopedTransaction transaction(&_txn, MODE_X);
Lock::GlobalWrite lk(_txn.lockState());
vector<BSONObj> ops;
{
- OldClientContext ctx(&_txn, cllNS());
- Database* db = ctx.db();
- Collection* coll = db->getCollection(cllNS());
-
- auto cursor = coll->getCursor(&_txn);
- while (auto record = cursor->next()) {
- ops.push_back(record->data.releaseToBson().getOwned());
+ DBDirectClient db(&_txn);
+ auto cursor = db.query(cllNS(), BSONObj());
+ while (cursor->more()) {
+ ops.push_back(cursor->nextSafe().getOwned());
}
}
{