summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2022-08-15 14:26:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-15 15:34:24 +0000
commitdab5cd5899ce6760ec5176b79821fcc45812624a (patch)
treee7abd3c22ea84da8bdb05f5790a3c86058cad92e /src/mongo/dbtests
parentabca3f700aa1da45ea14c8f2dc6ab52f952e3945 (diff)
downloadmongo-dab5cd5899ce6760ec5176b79821fcc45812624a.tar.gz
SERVER-68635 Move the whole insert path out of CollectionImpl
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/SConscript3
-rw-r--r--src/mongo/dbtests/counttests.cpp12
-rw-r--r--src/mongo/dbtests/dbhelper_tests.cpp16
-rw-r--r--src/mongo/dbtests/dbtests.h1
-rw-r--r--src/mongo/dbtests/deferred_writer.cpp4
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp65
-rw-r--r--src/mongo/dbtests/jsontests.cpp8
-rw-r--r--src/mongo/dbtests/jstests.cpp150
-rw-r--r--src/mongo/dbtests/multikey_paths_test.cpp31
-rw-r--r--src/mongo/dbtests/pdfiletests.cpp18
-rw-r--r--src/mongo/dbtests/plan_ranking.cpp41
-rw-r--r--src/mongo/dbtests/query_stage_cached_plan.cpp11
-rw-r--r--src/mongo/dbtests/query_stage_collscan.cpp67
-rw-r--r--src/mongo/dbtests/query_stage_count.cpp21
-rw-r--r--src/mongo/dbtests/query_stage_ixscan.cpp12
-rw-r--r--src/mongo/dbtests/query_stage_near.cpp31
-rw-r--r--src/mongo/dbtests/querytests.cpp13
-rw-r--r--src/mongo/dbtests/repltests.cpp27
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp60
-rw-r--r--src/mongo/dbtests/validate_tests.cpp464
20 files changed, 529 insertions, 526 deletions
diff --git a/src/mongo/dbtests/SConscript b/src/mongo/dbtests/SConscript
index eabf9fb48ea..f0c65377e4b 100644
--- a/src/mongo/dbtests/SConscript
+++ b/src/mongo/dbtests/SConscript
@@ -70,7 +70,7 @@ env.Library(
)
env.Program(
- target="dbtest",
+ target='dbtest',
source=[
'basictests.cpp',
'catalogtests.cpp',
@@ -141,6 +141,7 @@ env.Program(
"$BUILD_DIR/mongo/db/bson/dotted_path_support",
"$BUILD_DIR/mongo/db/catalog/catalog_helpers",
"$BUILD_DIR/mongo/db/catalog/clustered_collection_options",
+ "$BUILD_DIR/mongo/db/catalog/collection_crud",
"$BUILD_DIR/mongo/db/catalog/collection_validation",
"$BUILD_DIR/mongo/db/catalog/index_key_validate",
"$BUILD_DIR/mongo/db/catalog/multi_index_block",
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index 1b807d28395..b1c5aa77295 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -27,9 +27,7 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
@@ -38,6 +36,7 @@
#include "mongo/db/json.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace CountTests {
class Base {
@@ -99,10 +98,12 @@ protected:
oid.init();
b.appendOID("_id", &oid);
b.appendElements(o);
- _collection->insertDocument(&_opCtx, InsertStatement(b.obj()), nullOpDebug, false)
+ collection_internal::insertDocument(
+ &_opCtx, _collection, InsertStatement(b.obj()), nullOpDebug, false)
.transitional_ignore();
} else {
- _collection->insertDocument(&_opCtx, InsertStatement(o), nullOpDebug, false)
+ collection_internal::insertDocument(
+ &_opCtx, _collection, InsertStatement(o), nullOpDebug, false)
.transitional_ignore();
}
wunit.commit();
@@ -174,3 +175,4 @@ public:
OldStyleSuiteInitializer<All> myall;
} // namespace CountTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp
index dfda6c43a0d..188e287dc84 100644
--- a/src/mongo/dbtests/dbhelper_tests.cpp
+++ b/src/mongo/dbtests/dbhelper_tests.cpp
@@ -27,10 +27,8 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/client/dbclient_cursor.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
@@ -50,12 +48,8 @@
#include "mongo/util/assert_util.h"
namespace mongo {
-
namespace {
-using std::set;
-using std::unique_ptr;
-
/**
* Unit tests related to DBHelpers
*/
@@ -144,10 +138,10 @@ public:
WriteUnitOfWork wuow(opCtx1.get());
collection1 = db->createCollection(opCtx1.get(), nss, CollectionOptions(), true);
ASSERT_TRUE(collection1 != nullptr);
- ASSERT_TRUE(collection1
- ->insertDocument(
- opCtx1.get(), InsertStatement(doc), nullptr /* opDebug */, false)
- .isOK());
+ ASSERT_TRUE(
+ collection_internal::insertDocument(
+ opCtx1.get(), collection1, InsertStatement(doc), nullptr /* opDebug */, false)
+ .isOK());
wuow.commit();
}
diff --git a/src/mongo/dbtests/dbtests.h b/src/mongo/dbtests/dbtests.h
index 4c44f6a565b..3f0061d4c24 100644
--- a/src/mongo/dbtests/dbtests.h
+++ b/src/mongo/dbtests/dbtests.h
@@ -38,7 +38,6 @@
using namespace mongo;
using namespace mongo::unittest;
-using std::shared_ptr;
namespace mongo {
diff --git a/src/mongo/dbtests/deferred_writer.cpp b/src/mongo/dbtests/deferred_writer.cpp
index 90f4b29a366..ba30b6908f9 100644
--- a/src/mongo/dbtests/deferred_writer.cpp
+++ b/src/mongo/dbtests/deferred_writer.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include <chrono>
#include "mongo/bson/simple_bsonobj_comparator.h"
@@ -40,6 +38,7 @@
#include "mongo/dbtests/dbtests.h"
#include "mongo/stdx/chrono.h"
+namespace mongo {
namespace deferred_writer_tests {
namespace {
@@ -387,3 +386,4 @@ public:
OldStyleSuiteInitializer<DeferredWriterTests> deferredWriterTests;
} // namespace deferred_writer_tests
+} // namespace mongo
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index 5b11a9d6078..f29fad7cabb 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -27,11 +27,7 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <cstdint>
-
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/catalog/multi_index_block.h"
#include "mongo/db/catalog_raii.h"
@@ -43,8 +39,8 @@
#include "mongo/db/storage/storage_engine_init.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace IndexUpdateTests {
-
namespace {
const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
} // namespace
@@ -137,16 +133,18 @@ public:
{
WriteUnitOfWork wunit(_opCtx);
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(coll->insertDocument(_opCtx,
- InsertStatement(BSON("_id" << 1 << "a"
- << "dup")),
- nullOpDebug,
- true));
- ASSERT_OK(coll->insertDocument(_opCtx,
- InsertStatement(BSON("_id" << 2 << "a"
- << "dup")),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(_opCtx,
+ coll.get(),
+ InsertStatement(BSON("_id" << 1 << "a"
+ << "dup")),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(_opCtx,
+ coll.get(),
+ InsertStatement(BSON("_id" << 2 << "a"
+ << "dup")),
+ nullOpDebug,
+ true));
wunit.commit();
}
@@ -192,16 +190,18 @@ public:
{
WriteUnitOfWork wunit(_opCtx);
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(coll->insertDocument(_opCtx,
- InsertStatement(BSON("_id" << 1 << "a"
- << "dup")),
- nullOpDebug,
- true));
- ASSERT_OK(coll->insertDocument(_opCtx,
- InsertStatement(BSON("_id" << 2 << "a"
- << "dup")),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(_opCtx,
+ coll.get(),
+ InsertStatement(BSON("_id" << 1 << "a"
+ << "dup")),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(_opCtx,
+ coll.get(),
+ InsertStatement(BSON("_id" << 2 << "a"
+ << "dup")),
+ nullOpDebug,
+ true));
wunit.commit();
}
}
@@ -256,8 +256,8 @@ public:
int32_t nDocs = 1000;
OpDebug* const nullOpDebug = nullptr;
for (int32_t i = 0; i < nDocs; ++i) {
- ASSERT_OK(
- coll->insertDocument(_opCtx, InsertStatement(BSON("a" << i)), nullOpDebug));
+ ASSERT_OK(collection_internal::insertDocument(
+ _opCtx, coll.get(), InsertStatement(BSON("a" << i)), nullOpDebug));
}
wunit.commit();
}
@@ -306,8 +306,12 @@ public:
int32_t nDocs = 1000;
OpDebug* const nullOpDebug = nullptr;
for (int32_t i = 0; i < nDocs; ++i) {
- ASSERT_OK(coll->insertDocument(
- _opCtx, InsertStatement(BSON("_id" << i)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ _opCtx,
+ CollectionPtr(coll, CollectionPtr::NoYieldTag{}),
+ InsertStatement(BSON("_id" << i)),
+ nullOpDebug,
+ true));
}
wunit.commit();
// Request an interrupt.
@@ -714,3 +718,4 @@ public:
OldStyleSuiteInitializer<IndexUpdateTests> indexUpdateTests;
} // namespace IndexUpdateTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/jsontests.cpp b/src/mongo/dbtests/jsontests.cpp
index d732f2967ee..7fd425e3ad7 100644
--- a/src/mongo/dbtests/jsontests.cpp
+++ b/src/mongo/dbtests/jsontests.cpp
@@ -31,9 +31,6 @@
* Tests for json.{h,cpp} code and BSONObj::jsonString()
*/
-
-#include "mongo/platform/basic.h"
-
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <fmt/format.h>
@@ -46,12 +43,12 @@
#include "mongo/dbtests/dbtests.h"
#include "mongo/logv2/log.h"
#include "mongo/platform/decimal128.h"
-#include "mongo/unittest/unittest.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest
-
+namespace mongo {
namespace {
+
std::string makeJsonEquvalent(const std::string& json) {
boost::property_tree::ptree tree;
@@ -1199,3 +1196,4 @@ TEST(FromJsonTest, MinMaxKey) {
} // namespace FromJsonTests
} // namespace
+} // namespace mongo
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index 987e2d934c2..900fd3c404c 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -27,12 +27,6 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
-#include <iostream>
-#include <limits>
-
#include "mongo/base/parse_number.h"
#include "mongo/db/client.h"
#include "mongo/db/dbdirectclient.h"
@@ -49,14 +43,7 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
-
-using std::cout;
-using std::endl;
-using std::string;
-using std::stringstream;
-using std::unique_ptr;
-using std::vector;
-
+namespace mongo {
namespace JSTests {
using ScopeFactory = Scope* (ScriptEngine::*)();
@@ -74,7 +61,7 @@ template <ScopeFactory scopeFactory>
class BasicScope {
public:
void run() {
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset((getGlobalScriptEngine()->*scopeFactory)());
s->setNumber("x", 5);
@@ -99,7 +86,7 @@ class ResetScope {
public:
void run() {
/* Currently reset does not clear data in v8 or spidermonkey scopes. See SECURITY-10
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset( (getGlobalScriptEngine()->*scopeFactory)() );
s->setBoolean( "x" , true );
@@ -116,7 +103,7 @@ class FalseTests {
public:
void run() {
// Test falsy javascript values
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset((getGlobalScriptEngine()->*scopeFactory)());
ASSERT(!s->getBoolean("notSet"));
@@ -140,7 +127,7 @@ template <ScopeFactory scopeFactory>
class SimpleFunctions {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->invoke("x=5;", nullptr, nullptr);
ASSERT(5 == s->getNumber("x"));
@@ -169,7 +156,7 @@ template <ScopeFactory scopeFactory>
class ObjectMapping {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObj o = BSON("x" << 17.0 << "y"
<< "eliot"
@@ -227,7 +214,7 @@ template <ScopeFactory scopeFactory>
class ObjectDecoding {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->invoke("z = { num : 1 };", nullptr, nullptr);
BSONObj out = s->getObject("z");
@@ -251,7 +238,7 @@ class JSOIDTests {
public:
void run() {
#ifdef MOZJS
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->localConnect("blah");
@@ -283,7 +270,7 @@ template <ScopeFactory scopeFactory>
class SetImplicit {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObj o = BSON("foo"
<< "bar");
@@ -306,7 +293,7 @@ template <ScopeFactory scopeFactory>
class ObjectModReadonlyTests {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObj o = BSON("x" << 17 << "y"
<< "eliot"
@@ -345,7 +332,7 @@ template <ScopeFactory scopeFactory>
class OtherJSTypes {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
{
// date
@@ -390,8 +377,8 @@ public:
s->invoke("z = { a : x.r };", nullptr, nullptr);
BSONObj out = s->getObject("z");
- ASSERT_EQUALS((string) "^a", out["a"].regex());
- ASSERT_EQUALS((string) "i", out["a"].regexFlags());
+ ASSERT_EQUALS((std::string) "^a", out["a"].regex());
+ ASSERT_EQUALS((std::string) "i", out["a"].regexFlags());
// This regex used to cause a segfault because x isn't a valid flag for a js RegExp.
// Now it throws a JS exception.
@@ -443,7 +430,7 @@ template <ScopeFactory scopeFactory>
class SpecialDBTypes {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObjBuilder b;
b.appendTimestamp("a", 123456789);
@@ -478,7 +465,7 @@ template <ScopeFactory scopeFactory>
class TypeConservation {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
// -- A --
@@ -577,7 +564,7 @@ template <ScopeFactory scopeFactory>
class NumberLong {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObjBuilder b;
long long val = (long long)(0xbabadeadbeefbaddULL);
b.append("a", val);
@@ -590,15 +577,15 @@ public:
out = s->getObject("b");
ASSERT_EQUALS(mongo::NumberLong, out.firstElement().type());
if (val != out.firstElement().numberLong()) {
- cout << val << endl;
- cout << out.firstElement().numberLong() << endl;
- cout << out.toString() << endl;
+ std::cout << val << std::endl;
+ std::cout << out.firstElement().numberLong() << std::endl;
+ std::cout << out.toString() << std::endl;
ASSERT_EQUALS(val, out.firstElement().numberLong());
}
ASSERT(s->exec("c = {c:a.a.toString()}", "foo", false, true, false));
out = s->getObject("c");
- stringstream ss;
+ std::stringstream ss;
ss << "NumberLong(\"" << val << "\")";
ASSERT_EQUALS(ss.str(), out.firstElement().str());
@@ -637,7 +624,7 @@ template <ScopeFactory scopeFactory>
class NumberLong2 {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObj in;
{
@@ -653,9 +640,9 @@ public:
s->setObject("a", in);
ASSERT(s->exec("x = tojson( a ); ", "foo", false, true, false));
- string outString = s->getString("x");
+ std::string outString = s->getString("x");
- ASSERT(s->exec((string) "y = " + outString, "foo2", false, true, false));
+ ASSERT(s->exec((std::string) "y = " + outString, "foo2", false, true, false));
BSONObj out = s->getObject("y");
ASSERT_BSONOBJ_EQ(in, out);
}
@@ -665,7 +652,7 @@ template <ScopeFactory scopeFactory>
class NumberLongUnderLimit {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObjBuilder b;
// limit is 2^53
@@ -680,15 +667,15 @@ public:
out = s->getObject("b");
ASSERT_EQUALS(mongo::NumberLong, out.firstElement().type());
if (val != out.firstElement().numberLong()) {
- cout << val << endl;
- cout << out.firstElement().numberLong() << endl;
- cout << out.toString() << endl;
+ std::cout << val << std::endl;
+ std::cout << out.firstElement().numberLong() << std::endl;
+ std::cout << out.toString() << std::endl;
ASSERT_EQUALS(val, out.firstElement().numberLong());
}
ASSERT(s->exec("c = {c:a.a.toString()}", "foo", false, true, false));
out = s->getObject("c");
- stringstream ss;
+ std::stringstream ss;
ss << "NumberLong(\"" << val << "\")";
ASSERT_EQUALS(ss.str(), out.firstElement().str());
@@ -712,7 +699,7 @@ template <ScopeFactory scopeFactory>
class NumberDecimal {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObjBuilder b;
Decimal128 val = Decimal128("2.010");
b.append("a", val);
@@ -729,10 +716,10 @@ public:
ASSERT_EQUALS(mongo::NumberDecimal, out.firstElement().type());
ASSERT_TRUE(val.isEqual(out.firstElement().numberDecimal()));
- // Test that the appropriate string output is generated
+ // Test that the appropriatestd::string output is generated
ASSERT(s->exec("c = {c:a.a.toString()}", "foo", false, true, false));
out = s->getObject("c");
- stringstream ss;
+ std::stringstream ss;
ss << "NumberDecimal(\"" << val.toString() << "\")";
ASSERT_EQUALS(ss.str(), out.firstElement().str());
}
@@ -742,7 +729,7 @@ template <ScopeFactory scopeFactory>
class NumberDecimalGetFromScope {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
ASSERT(s->exec("a = 5;", "a", false, true, false));
ASSERT_TRUE(Decimal128(5).isEqual(s->getNumberDecimal("a")));
}
@@ -752,7 +739,7 @@ template <ScopeFactory scopeFactory>
class NumberDecimalBigObject {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
BSONObj in;
{
@@ -768,9 +755,9 @@ public:
s->setObject("a", in);
ASSERT(s->exec("x = tojson( a ); ", "foo", false, true, false));
- string outString = s->getString("x");
+ std::string outString = s->getString("x");
- ASSERT(s->exec((string) "y = " + outString, "foo2", false, true, false));
+ ASSERT(s->exec((std::string) "y = " + outString, "foo2", false, true, false));
BSONObj out = s->getObject("y");
ASSERT_BSONOBJ_EQ(in, out);
}
@@ -780,7 +767,7 @@ template <ScopeFactory scopeFactory>
class MaxTimestamp {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
// Timestamp 't' component can exceed max for int32_t.
BSONObj in;
@@ -810,7 +797,7 @@ public:
}
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
for (int i = 5; i < 100; i += 10) {
s->setObject("a", build(i), false);
@@ -829,7 +816,7 @@ template <ScopeFactory scopeFactory>
class ExecTimeout {
public:
void run() {
- unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
// assert timeout occurred
ASSERT(!scope->exec("var a = 1; while (true) { ; }", "ExecTimeout", false, true, false, 1));
@@ -843,7 +830,7 @@ template <ScopeFactory scopeFactory>
class ExecNoTimeout {
public:
void run() {
- unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
// assert no timeout occurred
ASSERT(scope->exec("var a = function() { return 1; }",
@@ -862,7 +849,7 @@ template <ScopeFactory scopeFactory>
class InvokeTimeout {
public:
void run() {
- unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
// scope timeout after 500ms
bool caught = false;
@@ -942,7 +929,7 @@ template <ScopeFactory scopeFactory>
class InvokeNoTimeout {
public:
void run() {
- unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
// invoke completes before timeout
scope->invokeSafe(
@@ -972,8 +959,8 @@ public:
private:
void check(const BSONObj& one, const BSONObj& two) {
if (one.woCompare(two) != 0) {
- static string fail =
- string("Assertion failure expected ") + one.toString() + ", got " + two.toString();
+ static std::string fail = std::string("Assertion failure expected ") + one.toString() +
+ ", got " + two.toString();
FAIL(fail.c_str());
}
}
@@ -998,15 +985,15 @@ public:
void pp(const char* s, BSONElement e) {
int len;
const char* data = e.binData(len);
- cout << s << ":" << e.binDataType() << "\t" << len << endl;
- cout << "\t";
+ std::cout << s << ":" << e.binDataType() << "\t" << len << std::endl;
+ std::cout << "\t";
for (int i = 0; i < len; i++)
- cout << (int)(data[i]) << " ";
- cout << endl;
+ std::cout << (int)(data[i]) << " ";
+ std::cout << std::endl;
}
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
const char* foo = "asdas\0asdasd";
const char* base64 = "YXNkYXMAYXNkYXNk";
@@ -1031,14 +1018,14 @@ public:
// check that BinData js class is utilized
s->invokeSafe("q = x.b.toString();", nullptr, nullptr);
- stringstream expected;
+ std::stringstream expected;
expected << "BinData(" << BinDataGeneral << ",\"" << base64 << "\")";
ASSERT_EQUALS(expected.str(), s->getString("q"));
- stringstream scriptBuilder;
+ std::stringstream scriptBuilder;
scriptBuilder << "z = { c : new BinData( " << BinDataGeneral << ", \"" << base64
<< "\" ) };";
- string script = scriptBuilder.str();
+ std::string script = scriptBuilder.str();
s->invokeSafe(script.c_str(), nullptr, nullptr);
out = s->getObject("z");
// pp( "out" , out["c"] );
@@ -1057,7 +1044,7 @@ template <ScopeFactory scopeFactory>
class VarTests {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
ASSERT(s->exec("a = 5;", "a", false, true, false));
ASSERT_EQUALS(5, s->getNumber("a"));
@@ -1074,7 +1061,7 @@ public:
BSONObj start = BSON("x" << 5.0);
BSONObj empty;
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset((getGlobalScriptEngine()->*scopeFactory)());
ScriptingFunction f = s->createFunction("return this.x + 6;");
@@ -1085,7 +1072,7 @@ public:
s->invoke(f, &empty, &start);
ASSERT_EQUALS(11, s->getNumber("__returnValue"));
}
- // cout << "speed1: " << ( n / t.millis() ) << " ops/ms" << endl;
+ // std::cout << "speed1: " << ( n / t.millis() ) << " ops/ms" << std::endl;
}
};
@@ -1093,7 +1080,7 @@ template <ScopeFactory scopeFactory>
class ScopeOut {
public:
void run() {
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset((getGlobalScriptEngine()->*scopeFactory)());
s->invokeSafe("x = 5;", nullptr, nullptr);
@@ -1120,7 +1107,7 @@ template <ScopeFactory scopeFactory>
class RenameTest {
public:
void run() {
- unique_ptr<Scope> s;
+ std::unique_ptr<Scope> s;
s.reset((getGlobalScriptEngine()->*scopeFactory)());
s->setNumber("x", 5);
@@ -1164,7 +1151,7 @@ public:
0xff,
0,
};
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->setObject("val", BSONObj(reinterpret_cast<char*>(bits)).getOwned());
@@ -1177,7 +1164,7 @@ template <ScopeFactory scopeFactory>
class NoReturnSpecified {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->invoke("x=5;", nullptr, nullptr);
ASSERT_EQUALS(5, s->getNumber("__returnValue"));
@@ -1232,7 +1219,7 @@ public:
}
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->injectNative("foo", callback, s.get());
s->invoke("var x = 1; foo();", nullptr, nullptr);
@@ -1244,7 +1231,7 @@ template <ScopeFactory scopeFactory>
class ErrorCodeFromInvoke {
public:
void run() {
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
{
bool threwException = false;
@@ -1287,7 +1274,7 @@ public:
return {};
};
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->injectNative("foo", sidecarThrowingFunc);
@@ -1313,14 +1300,14 @@ public:
// Ensure that by default we can bind owned and unowned
{
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->setObject("unowned", unowned, true);
s->setObject("owned", owned, true);
}
// After we set the flag, we should only be able to set owned
{
- unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
s->requireOwnedObjects();
s->setObject("owned", owned, true);
@@ -1347,7 +1334,7 @@ public:
template <ScopeFactory scopeFactory>
class ConvertShardKeyToHashed {
public:
- void check(shared_ptr<Scope> s, const mongo::BSONObj& o) {
+ void check(std::shared_ptr<Scope> s, const mongo::BSONObj& o) {
s->setObject("o", o, true);
s->invoke("return convertShardKeyToHashed(o);", nullptr, nullptr);
const auto scopeShardKey = s->getNumber("__returnValue");
@@ -1361,17 +1348,17 @@ public:
ASSERT_EQUALS(scopeShardKey, trueShardKey);
}
- void checkNoArgs(shared_ptr<Scope> s) {
+ void checkNoArgs(std::shared_ptr<Scope> s) {
s->invoke("return convertShardKeyToHashed();", nullptr, nullptr);
}
- void checkWithExtraArg(shared_ptr<Scope> s, const mongo::BSONObj& o, int seed) {
+ void checkWithExtraArg(std::shared_ptr<Scope> s, const mongo::BSONObj& o, int seed) {
s->setObject("o", o, true);
s->invoke("return convertShardKeyToHashed(o, 1);", nullptr, nullptr);
}
void run() {
- shared_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
+ std::shared_ptr<Scope> s((getGlobalScriptEngine()->*scopeFactory)());
shell_utils::installShellUtils(*s);
// Check a few elementary objects
@@ -1399,7 +1386,7 @@ template <ScopeFactory scopeFactory>
class BasicAsyncJS {
public:
void run() {
- unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
+ std::unique_ptr<Scope> scope((getGlobalScriptEngine()->*scopeFactory)());
scope->setNumber("x", 0);
/* The async code will get run after the return, so
@@ -1483,3 +1470,4 @@ public:
OldStyleSuiteInitializer<All> myall;
} // namespace JSTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/multikey_paths_test.cpp b/src/mongo/dbtests/multikey_paths_test.cpp
index 34afd00fa0e..6e7a9e80520 100644
--- a/src/mongo/dbtests/multikey_paths_test.cpp
+++ b/src/mongo/dbtests/multikey_paths_test.cpp
@@ -27,11 +27,7 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <iostream>
-#include <string>
-
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/index/index_descriptor.h"
@@ -140,8 +136,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 0 << "a" << 5 << "b" << BSON_ARRAY(1 << 2 << 3))),
nullOpDebug));
wuow.commit();
@@ -164,12 +161,14 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) {
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 0 << "a" << 5 << "b" << BSON_ARRAY(1 << 2 << 3))),
nullOpDebug));
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 1 << "a" << BSON_ARRAY(1 << 2 << 3) << "b" << 5)),
nullOpDebug));
wuow.commit();
@@ -198,8 +197,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 0 << "a" << 5 << "b" << BSON_ARRAY(1 << 2 << 3))),
nullOpDebug));
wuow.commit();
@@ -210,8 +210,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 1 << "a" << BSON_ARRAY(1 << 2 << 3) << "b" << 5)),
nullOpDebug));
wuow.commit();
@@ -232,8 +233,8 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) {
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
- _opCtx.get(), InsertStatement(BSON("_id" << 0 << "a" << 5)), nullOpDebug));
+ ASSERT_OK(collection_internal::insertDocument(
+ _opCtx.get(), *collection, InsertStatement(BSON("_id" << 0 << "a" << 5)), nullOpDebug));
wuow.commit();
}
@@ -278,8 +279,9 @@ TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) {
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(BSON("_id" << 0 << "a" << 5 << "b" << BSON_ARRAY(1 << 2 << 3))),
nullOpDebug));
wuow.commit();
@@ -322,8 +324,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) {
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
_opCtx.get(),
+ *collection,
InsertStatement(
BSON("_id" << 0 << "a" << BSON_ARRAY(1 << 2 << 3) << "b" << 5 << "c" << 8)),
nullOpDebug));
diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp
index b22fee7e066..c5d41844fa6 100644
--- a/src/mongo/dbtests/pdfiletests.cpp
+++ b/src/mongo/dbtests/pdfiletests.cpp
@@ -27,22 +27,17 @@
* it in the license file.
*/
-/**
- * pdfile unit tests
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/json.h"
#include "mongo/db/ops/insert.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace PdfileTests {
-
namespace Insert {
+
class Base {
public:
Base() : _lk(&_opCtx), _context(&_opCtx, nss()) {}
@@ -82,13 +77,15 @@ public:
}
ASSERT(coll);
OpDebug* const nullOpDebug = nullptr;
- ASSERT(!coll->insertDocument(&_opCtx, InsertStatement(x), nullOpDebug, true).isOK());
+ ASSERT_NOT_OK(collection_internal::insertDocument(
+ &_opCtx, coll, InsertStatement(x), nullOpDebug, true));
StatusWith<BSONObj> fixed = fixDocumentForInsert(&_opCtx, x);
ASSERT(fixed.isOK());
x = fixed.getValue();
ASSERT(x["_id"].type() == jstOID);
- ASSERT(coll->insertDocument(&_opCtx, InsertStatement(x), nullOpDebug, true).isOK());
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll, InsertStatement(x), nullOpDebug, true));
wunit.commit();
}
};
@@ -171,3 +168,4 @@ public:
OldStyleSuiteInitializer<All> myall;
} // namespace PdfileTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp
index a503185daf2..a9be3d8c35b 100644
--- a/src/mongo/dbtests/plan_ranking.cpp
+++ b/src/mongo/dbtests/plan_ranking.cpp
@@ -31,11 +31,6 @@
* This file tests db/query/plan_ranker.cpp and db/query/multi_plan_runner.cpp.
*/
-#include "mongo/platform/basic.h"
-
-#include <iostream>
-#include <memory>
-
#include "mongo/client/dbclient_cursor.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
@@ -67,13 +62,8 @@ extern AtomicWord<int> internalQueryMaxBlockingSortMemoryUsageBytes;
extern AtomicWord<int> internalQueryPlanEvaluationMaxResults;
-} // namespace mongo
-
namespace PlanRankingTests {
-using std::unique_ptr;
-using std::vector;
-
static const NamespaceString nss("unittests.PlanRankingTests");
class PlanRankingTestBase {
@@ -128,7 +118,7 @@ public:
// Fill out the MPR.
_mps.reset(new MultiPlanStage(_expCtx.get(), collection.getCollection(), cq));
- unique_ptr<WorkingSet> ws(new WorkingSet());
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
// Put each solution from the planner into the MPR.
for (size_t i = 0; i < solutions.size(); ++i) {
auto&& root = stage_builder::buildClassicExecutableTree(
@@ -181,7 +171,7 @@ private:
// of the test.
bool _enableHashIntersection;
- unique_ptr<MultiPlanStage> _mps;
+ std::unique_ptr<MultiPlanStage> _mps;
DBDirectClient _client;
};
@@ -236,7 +226,7 @@ public:
findCommand->setSort(BSON("d" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(cq);
auto soln = pickBestPlan(cq.get());
@@ -285,7 +275,7 @@ public:
addIndex(BSON("a" << 1));
addIndex(BSON("b" << 1));
- unique_ptr<CanonicalQuery> cq;
+ std::unique_ptr<CanonicalQuery> cq;
// Run the query {a:4, b:1}.
{
@@ -348,7 +338,7 @@ public:
findCommand->setFilter(BSON("a" << 1 << "b" << BSON("$gt" << 1)));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
verify(statusWithCQ.isOK());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// Turn on the "force intersect" option.
@@ -389,7 +379,7 @@ public:
findCommand->setProjection(BSON("_id" << 0 << "a" << 1 << "b" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
auto soln = pickBestPlan(cq.get());
@@ -424,7 +414,7 @@ public:
findCommand->setFilter(BSON("a" << 1 << "b" << 1 << "c" << 99));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
auto soln = pickBestPlan(cq.get());
@@ -463,7 +453,7 @@ public:
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
auto soln = pickBestPlan(cq.get());
@@ -497,7 +487,7 @@ public:
findCommand->setFilter(BSON("a" << N + 1 << "b" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
verify(statusWithCQ.isOK());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// {a: 100} is super selective so choose that.
@@ -534,7 +524,7 @@ public:
findCommand->setFilter(BSON("a" << BSON("$gte" << N + 1) << "b" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
verify(statusWithCQ.isOK());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// {a: 100} is super selective so choose that.
@@ -565,7 +555,7 @@ public:
findCommand->setSort(BSON("c" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
auto soln = pickBestPlan(cq.get());
@@ -595,7 +585,7 @@ public:
findCommand->setFilter(BSON("foo" << 2001));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
verify(statusWithCQ.isOK());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
auto soln = pickBestPlan(cq.get());
@@ -630,7 +620,7 @@ public:
findCommand->setSort(BSON("d" << 1));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// No results will be returned during the trial period,
@@ -668,7 +658,7 @@ public:
findCommand->setFilter(fromjson("{a: 1, b: 1, c: {$gte: 5000}}"));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// Use index on 'b'.
@@ -701,7 +691,7 @@ public:
findCommand->setFilter(fromjson("{a: 9, b: {$ne: 10}, c: 9}"));
auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(findCommand));
ASSERT_OK(statusWithCQ.getStatus());
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
ASSERT(nullptr != cq.get());
// Expect to use index {a: 1, b: 1}.
@@ -736,3 +726,4 @@ public:
OldStyleSuiteInitializer<All> planRankingAll;
} // namespace PlanRankingTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp
index 26ab912dcff..5b92c768874 100644
--- a/src/mongo/dbtests/query_stage_cached_plan.cpp
+++ b/src/mongo/dbtests/query_stage_cached_plan.cpp
@@ -27,12 +27,8 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <memory>
-
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/database.h"
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/client.h"
@@ -53,6 +49,7 @@
#include "mongo/db/query/query_planner_params.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace QueryStageCachedPlan {
static const NamespaceString nss("unittests.QueryStageCachedPlan");
@@ -116,7 +113,8 @@ public:
WriteUnitOfWork wuow(&_opCtx);
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(collection->insertDocument(&_opCtx, InsertStatement(obj), nullOpDebug));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, collection, InsertStatement(obj), nullOpDebug));
wuow.commit();
}
@@ -550,3 +548,4 @@ TEST_F(QueryStageCachedPlan, DoesNotThrowOnYieldRecoveryWhenIndexIsDroppedAferPl
}
} // namespace QueryStageCachedPlan
+} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp
index 0b2fccc32b0..fa180a525b6 100644
--- a/src/mongo/dbtests/query_stage_collscan.cpp
+++ b/src/mongo/dbtests/query_stage_collscan.cpp
@@ -31,11 +31,7 @@
* This file tests db/exec/collection_scan.cpp.
*/
-
-#include "mongo/platform/basic.h"
-
#include <fmt/printf.h>
-#include <memory>
#include "mongo/client/dbclient_cursor.h"
#include "mongo/db/catalog/clustered_collection_options_gen.h"
@@ -56,17 +52,13 @@
#include "mongo/db/storage/record_store.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/logv2/log.h"
-#include "mongo/unittest/unittest.h"
#include "mongo/util/fail_point.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest
-
+namespace mongo {
namespace query_stage_collection_scan {
-using std::unique_ptr;
-using std::vector;
-
static const NamespaceString nss{"unittests.QueryStageCollectionScan"};
//
@@ -106,11 +98,11 @@ public:
StatusWithMatchExpression statusWithMatcher =
MatchExpressionParser::parse(filterObj, _expCtx);
verify(statusWithMatcher.isOK());
- unique_ptr<MatchExpression> filterExpr = std::move(statusWithMatcher.getValue());
+ std::unique_ptr<MatchExpression> filterExpr = std::move(statusWithMatcher.getValue());
// Make a scan and have the runner own it.
- unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
- unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
+ std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
+ std::unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
_expCtx.get(), collection.getCollection(), params, ws.get(), filterExpr.get());
auto statusWithPlanExecutor =
@@ -135,14 +127,14 @@ public:
void getRecordIds(const CollectionPtr& collection,
CollectionScanParams::Direction direction,
- vector<RecordId>* out) {
+ std::vector<RecordId>* out) {
WorkingSet ws;
CollectionScanParams params;
params.direction = direction;
params.tailable = false;
- unique_ptr<CollectionScan> scan(
+ std::unique_ptr<CollectionScan> scan(
new CollectionScan(_expCtx.get(), collection, params, &ws, nullptr));
while (!scan->isEOF()) {
WorkingSetID id = WorkingSet::INVALID_ID;
@@ -207,7 +199,9 @@ public:
_client.insert(ns.ns(), doc);
}
- void insertDocuments(const NamespaceString& ns, const vector<BSONObj>& docs, bool ordered) {
+ void insertDocuments(const NamespaceString& ns,
+ const std::vector<BSONObj>& docs,
+ bool ordered) {
_client.insert(ns.ns(), docs, ordered);
}
@@ -266,7 +260,7 @@ public:
boost::optional<RecordIdBound> minRecord,
boost::optional<RecordIdBound> maxRecord,
CollectionScanParams::ScanBoundInclusion boundInclusion,
- const vector<BSONObj>& expectedResults,
+ const std::vector<BSONObj>& expectedResults,
const MatchExpression* filter = nullptr) {
AutoGetCollectionForRead autoColl(&_opCtx, ns);
@@ -351,8 +345,8 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanObjectsInOrderForward) {
params.tailable = false;
// Make a scan and have the runner own it.
- unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
- unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
+ std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
+ std::unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
_expCtx.get(), collection.getCollection(), params, ws.get(), nullptr);
auto statusWithPlanExecutor =
@@ -384,8 +378,8 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanObjectsInOrderBackward) {
params.direction = CollectionScanParams::BACKWARD;
params.tailable = false;
- unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
- unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
+ std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
+ std::unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
_expCtx.get(), collection.getCollection(), params, ws.get(), nullptr);
auto statusWithPlanExecutor =
@@ -416,7 +410,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObject) {
const CollectionPtr& coll = ctx.getCollection();
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
// Configure the scan.
@@ -425,7 +419,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObject) {
params.tailable = false;
WorkingSet ws;
- unique_ptr<PlanStage> scan(new CollectionScan(_expCtx.get(), coll, params, &ws, nullptr));
+ std::unique_ptr<PlanStage> scan(new CollectionScan(_expCtx.get(), coll, params, &ws, nullptr));
int count = 0;
while (count < 10) {
@@ -469,7 +463,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObjectBackw
const CollectionPtr& coll = ctx.getCollection();
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::BACKWARD, &recordIds);
// Configure the scan.
@@ -478,7 +472,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObjectBackw
params.tailable = false;
WorkingSet ws;
- unique_ptr<PlanStage> scan(new CollectionScan(_expCtx.get(), coll, params, &ws, nullptr));
+ std::unique_ptr<PlanStage> scan(new CollectionScan(_expCtx.get(), coll, params, &ws, nullptr));
int count = 0;
while (count < 10) {
@@ -521,7 +515,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanResumeAfterRecordIdSeekSuc
AutoGetCollectionForReadCommand collection(&_opCtx, nss);
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(collection.getCollection(), CollectionScanParams::FORWARD, &recordIds);
// We will resume the collection scan this many results in.
@@ -535,8 +529,8 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanResumeAfterRecordIdSeekSuc
params.resumeAfterRecordId = recordIds[offset - 1];
// Create plan stage.
- unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
- unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
+ std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
+ std::unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>(
_expCtx.get(), collection.getCollection(), params, ws.get(), nullptr);
WorkingSetID id = WorkingSet::INVALID_ID;
@@ -572,7 +566,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanResumeAfterRecordIdSeekFai
auto coll = ctx.getCollection();
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
// We will resume the collection scan this many results in.
@@ -589,8 +583,8 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanResumeAfterRecordIdSeekFai
params.resumeAfterRecordId = recordId;
// Create plan stage.
- unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
- unique_ptr<PlanStage> ps =
+ std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>();
+ std::unique_ptr<PlanStage> ps =
std::make_unique<CollectionScan>(_expCtx.get(), coll, params, ws.get(), nullptr);
WorkingSetID id = WorkingSet::INVALID_ID;
@@ -608,7 +602,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredMinMax) {
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
ASSERT(recordIds.size());
@@ -813,7 +807,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredReverse) {
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by a backwards scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::BACKWARD, &recordIds);
ASSERT(recordIds.size());
@@ -857,7 +851,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredMinMaxFullObjectI
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
ASSERT(recordIds.size());
@@ -901,7 +895,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredInnerRange) {
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
ASSERT(recordIds.size());
@@ -950,7 +944,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredInnerRangeExclusi
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by an in-order scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::FORWARD, &recordIds);
ASSERT(recordIds.size());
@@ -1015,7 +1009,7 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanClusteredInnerRangeExclusi
ASSERT(coll->isClustered());
// Get the RecordIds that would be returned by a reverse scan.
- vector<RecordId> recordIds;
+ std::vector<RecordId> recordIds;
getRecordIds(coll, CollectionScanParams::BACKWARD, &recordIds);
ASSERT(recordIds.size());
@@ -1373,3 +1367,4 @@ TEST_F(QueryStageCollectionScanTest, QueryTestCollscanChangeCollectionGetLatestO
ASSERT_EQUALS(Timestamp(16, 1), scanStage->getLatestOplogTimestamp());
}
} // namespace query_stage_collection_scan
+} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp
index 712ad9b7298..67f25307768 100644
--- a/src/mongo/dbtests/query_stage_count.cpp
+++ b/src/mongo/dbtests/query_stage_count.cpp
@@ -27,10 +27,7 @@
* it in the license file.
*/
-#include <memory>
-
-#include "mongo/platform/basic.h"
-
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/d_concurrency.h"
@@ -46,11 +43,9 @@
#include "mongo/db/query/count_command_gen.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace QueryStageCount {
-using std::unique_ptr;
-using std::vector;
-
const int kDocuments = 100;
const int kInterjections = kDocuments;
const NamespaceString kTestNss = NamespaceString("db.dummy");
@@ -97,7 +92,7 @@ public:
params.direction = CollectionScanParams::FORWARD;
params.tailable = false;
- unique_ptr<CollectionScan> scan(
+ std::unique_ptr<CollectionScan> scan(
new CollectionScan(_expCtx.get(), _coll, params, &ws, nullptr));
while (!scan->isEOF()) {
WorkingSetID id = WorkingSet::INVALID_ID;
@@ -113,7 +108,8 @@ public:
void insert(const BSONObj& doc) {
WriteUnitOfWork wunit(&_opCtx);
OpDebug* const nullOpDebug = nullptr;
- _coll->insertDocument(&_opCtx, InsertStatement(doc), nullOpDebug).transitional_ignore();
+ collection_internal::insertDocument(&_opCtx, _coll, InsertStatement(doc), nullOpDebug)
+ .transitional_ignore();
wunit.commit();
}
@@ -150,12 +146,12 @@ public:
setup();
getRecordIds();
- unique_ptr<WorkingSet> ws(new WorkingSet);
+ std::unique_ptr<WorkingSet> ws(new WorkingSet);
StatusWithMatchExpression statusWithMatcher =
MatchExpressionParser::parse(request.getQuery(), _expCtx);
ASSERT(statusWithMatcher.isOK());
- unique_ptr<MatchExpression> expression = std::move(statusWithMatcher.getValue());
+ std::unique_ptr<MatchExpression> expression = std::move(statusWithMatcher.getValue());
PlanStage* scan;
if (indexed) {
@@ -236,7 +232,7 @@ public:
}
protected:
- vector<RecordId> _recordIds;
+ std::vector<RecordId> _recordIds;
const ServiceContext::UniqueOperationContext _opCtxPtr = cc().makeOperationContext();
OperationContext& _opCtx = *_opCtxPtr;
Lock::DBLock _dbLock;
@@ -380,3 +376,4 @@ public:
OldStyleSuiteInitializer<All> queryStageCountAll;
} // namespace QueryStageCount
+} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp
index eebc893d2d5..397027be9d2 100644
--- a/src/mongo/dbtests/query_stage_ixscan.cpp
+++ b/src/mongo/dbtests/query_stage_ixscan.cpp
@@ -27,8 +27,7 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
@@ -39,6 +38,7 @@
#include "mongo/db/json.h"
#include "mongo/dbtests/dbtests.h"
+namespace mongo {
namespace QueryStageIxscan {
namespace {
const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
@@ -73,7 +73,12 @@ public:
void insert(const BSONObj& doc) {
WriteUnitOfWork wunit(&_opCtx);
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(_coll->insertDocument(&_opCtx, InsertStatement(doc), nullOpDebug, false));
+ ASSERT_OK(
+ collection_internal::insertDocument(&_opCtx,
+ CollectionPtr(_coll, CollectionPtr::NoYieldTag{}),
+ InsertStatement(doc),
+ nullOpDebug,
+ false));
wunit.commit();
}
@@ -335,3 +340,4 @@ public:
OldStyleSuiteInitializer<All> aueryStageIxscanAll;
} // namespace QueryStageIxscan
+} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp
index e26ac67509c..cce8ad0dab5 100644
--- a/src/mongo/dbtests/query_stage_near.cpp
+++ b/src/mongo/dbtests/query_stage_near.cpp
@@ -44,15 +44,10 @@
#include "mongo/db/exec/queued_data_stage.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/dbtests/dbtests.h"
-#include "mongo/unittest/unittest.h"
+namespace mongo {
namespace {
-using namespace mongo;
-using std::shared_ptr;
-using std::unique_ptr;
-using std::vector;
-
const std::string kTestNamespace = "test.coll";
const BSONObj kTestKeyPattern = BSON("testIndex" << 1);
@@ -101,10 +96,10 @@ protected:
class MockNearStage final : public NearStage {
public:
struct MockInterval {
- MockInterval(const vector<BSONObj>& data, double min, double max)
+ MockInterval(const std::vector<BSONObj>& data, double min, double max)
: data(data), min(min), max(max) {}
- vector<BSONObj> data;
+ std::vector<BSONObj> data;
double min;
double max;
};
@@ -121,7 +116,7 @@ public:
indexDescriptor),
_pos(0) {}
- void addInterval(vector<BSONObj> data, double min, double max) {
+ void addInterval(std::vector<BSONObj> data, double min, double max) {
_intervals.push_back(std::make_unique<MockInterval>(data, min, max));
}
@@ -167,8 +162,8 @@ private:
int _pos;
};
-static vector<BSONObj> advanceStage(PlanStage* stage, WorkingSet* workingSet) {
- vector<BSONObj> results;
+static std::vector<BSONObj> advanceStage(PlanStage* stage, WorkingSet* workingSet) {
+ std::vector<BSONObj> results;
WorkingSetID nextMemberID;
PlanStage::StageState state = PlanStage::NEED_TIME;
@@ -182,9 +177,9 @@ static vector<BSONObj> advanceStage(PlanStage* stage, WorkingSet* workingSet) {
return results;
}
-static void assertAscendingAndValid(const vector<BSONObj>& results) {
+static void assertAscendingAndValid(const std::vector<BSONObj>& results) {
double lastDistance = -1.0;
- for (vector<BSONObj>::const_iterator it = results.begin(); it != results.end(); ++it) {
+ for (std::vector<BSONObj>::const_iterator it = results.begin(); it != results.end(); ++it) {
double distance = (*it)["distance"].numberDouble();
bool shouldInclude = (*it)["$included"].eoo() || (*it)["$included"].trueValue();
ASSERT(shouldInclude);
@@ -194,7 +189,7 @@ static void assertAscendingAndValid(const vector<BSONObj>& results) {
}
TEST_F(QueryStageNearTest, Basic) {
- vector<BSONObj> mockData;
+ std::vector<BSONObj> mockData;
WorkingSet workingSet;
MockNearStage nearStage(_expCtx.get(), &workingSet, getCollection(), _mockGeoIndex);
@@ -223,13 +218,13 @@ TEST_F(QueryStageNearTest, Basic) {
mockData.push_back(BSON("distance" << 3.5)); // Not included
nearStage.addInterval(mockData, 2.0, 3.0);
- vector<BSONObj> results = advanceStage(&nearStage, &workingSet);
+ std::vector<BSONObj> results = advanceStage(&nearStage, &workingSet);
ASSERT_EQUALS(results.size(), 8u);
assertAscendingAndValid(results);
}
TEST_F(QueryStageNearTest, EmptyResults) {
- vector<BSONObj> mockData;
+ std::vector<BSONObj> mockData;
WorkingSet workingSet;
AutoGetCollectionForReadMaybeLockFree autoColl(_opCtx, NamespaceString{kTestNamespace});
@@ -249,8 +244,10 @@ TEST_F(QueryStageNearTest, EmptyResults) {
mockData.push_back(BSON("distance" << 1.0));
nearStage.addInterval(mockData, 1.0, 2.0);
- vector<BSONObj> results = advanceStage(&nearStage, &workingSet);
+ std::vector<BSONObj> results = advanceStage(&nearStage, &workingSet);
ASSERT_EQUALS(results.size(), 3u);
assertAscendingAndValid(results);
}
+
} // namespace
+} // namespace mongo
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index a10c20504aa..1e5407d62b5 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -27,13 +27,11 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include <boost/optional.hpp>
#include <iostream>
#include "mongo/client/dbclient_cursor.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/multi_index_block.h"
#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
@@ -49,7 +47,6 @@
#include "mongo/db/query/find.h"
#include "mongo/db/service_context.h"
#include "mongo/dbtests/dbtests.h"
-#include "mongo/unittest/unittest.h"
#include "mongo/util/timer.h"
namespace mongo {
@@ -62,7 +59,7 @@ void insertOplogDocument(OperationContext* opCtx, Timestamp ts, const char* ns)
InsertStatement stmt;
stmt.doc = doc;
stmt.oplogSlot = OplogSlot{ts, OplogSlot::kInitialTerm};
- auto status = coll->insertDocument(opCtx, stmt, nullptr);
+ auto status = collection_internal::insertDocument(opCtx, *coll, stmt, nullptr);
if (!status.isOK()) {
std::cout << "Failed to insert oplog document: " << status.toString() << std::endl;
}
@@ -158,10 +155,12 @@ protected:
oid.init();
b.appendOID("_id", &oid);
b.appendElements(o);
- _collection->insertDocument(&_opCtx, InsertStatement(b.obj()), nullOpDebug, false)
+ collection_internal::insertDocument(
+ &_opCtx, _collection, InsertStatement(b.obj()), nullOpDebug, false)
.transitional_ignore();
} else {
- _collection->insertDocument(&_opCtx, InsertStatement(o), nullOpDebug, false)
+ collection_internal::insertDocument(
+ &_opCtx, _collection, InsertStatement(o), nullOpDebug, false)
.transitional_ignore();
}
wunit.commit();
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 84cf1bc9fbd..272c20d0e64 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -27,12 +27,9 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
#include "mongo/bson/mutable/document.h"
#include "mongo/bson/mutable/mutable_bson_test_utils.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/exception_util.h"
@@ -51,15 +48,10 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
-
namespace mongo {
namespace repl {
namespace ReplTests {
-using std::string;
-using std::unique_ptr;
-using std::vector;
-
/**
* Creates an OplogEntry with given parameters and preset defaults for this test suite.
*/
@@ -223,7 +215,7 @@ protected:
}
void applyAllOperations() {
Lock::GlobalWrite lk(&_opCtx);
- vector<BSONObj> ops;
+ std::vector<BSONObj> ops;
{
DBDirectClient db(&_opCtx);
auto cursor = db.find(FindCommandRequest{NamespaceString{cllNS()}});
@@ -242,10 +234,7 @@ protected:
}
OldClientContext ctx(&_opCtx, nss());
- for (vector<BSONObj>::iterator i = ops.begin(); i != ops.end(); ++i) {
- if (0) {
- LOGV2(22501, "op: {i}", "i"_attr = *i);
- }
+ for (std::vector<BSONObj>::iterator i = ops.begin(); i != ops.end(); ++i) {
repl::UnreplicatedWritesBlock uwb(&_opCtx);
auto entry = uassertStatusOK(OplogEntry::parse(*i));
// Handle the case of batched writes which generate command-type (applyOps) oplog
@@ -316,7 +305,8 @@ protected:
OpDebug* const nullOpDebug = nullptr;
if (o.hasField("_id")) {
repl::UnreplicatedWritesBlock uwb(&_opCtx);
- coll->insertDocument(&_opCtx, InsertStatement(o), nullOpDebug, true)
+ collection_internal::insertDocument(
+ &_opCtx, coll, InsertStatement(o), nullOpDebug, true)
.transitional_ignore();
ASSERT_OK(_opCtx.recoveryUnit()->setTimestamp(nextTimestamp));
wunit.commit();
@@ -329,7 +319,8 @@ protected:
b.appendOID("_id", &id);
b.appendElements(o);
repl::UnreplicatedWritesBlock uwb(&_opCtx);
- coll->insertDocument(&_opCtx, InsertStatement(b.obj()), nullOpDebug, true)
+ collection_internal::insertDocument(
+ &_opCtx, coll, InsertStatement(b.obj()), nullOpDebug, true)
.transitional_ignore();
ASSERT_OK(_opCtx.recoveryUnit()->setTimestamp(nextTimestamp));
wunit.commit();
@@ -446,7 +437,7 @@ class InsertTwo : public Recovering {
public:
InsertTwo() : o_(fromjson("{'_id':1,a:'b'}")), t_(fromjson("{'_id':2,c:'d'}")) {}
void doIt() const {
- vector<BSONObj> v;
+ std::vector<BSONObj> v;
v.push_back(o_);
v.push_back(t_);
_client.insert(ns(), v);
@@ -787,7 +778,7 @@ protected:
class MultiInc : public Recovering {
public:
- string s() const {
+ std::string s() const {
StringBuilder ss;
FindCommandRequest findRequest{NamespaceString{ns()}};
findRequest.setSort(BSON("_id" << 1));
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index 27cc030a169..5058eb3f8c7 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -27,10 +27,8 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/bson/bsonobj.h"
-#include "mongo/db/catalog/collection.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/catalog/drop_collection.h"
#include "mongo/db/catalog/rename_collection.h"
@@ -40,16 +38,11 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/record_id.h"
#include "mongo/dbtests/dbtests.h"
-#include "mongo/unittest/unittest.h"
-
-using mongo::unittest::assertGet;
-using std::list;
-using std::string;
-using std::unique_ptr;
+namespace mongo {
namespace RollbackTests {
-
namespace {
+
const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
void dropDatabase(OperationContext* opCtx, const NamespaceString& nss) {
@@ -61,7 +54,8 @@ void dropDatabase(OperationContext* opCtx, const NamespaceString& nss) {
databaseHolder->dropDb(opCtx, db);
}
}
-bool collectionExists(OperationContext* opCtx, OldClientContext* ctx, const string& ns) {
+
+bool collectionExists(OperationContext* opCtx, OldClientContext* ctx, const std::string& ns) {
return (bool)CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx,
NamespaceString(ns));
}
@@ -78,12 +72,14 @@ void createCollection(OperationContext* opCtx, const NamespaceString& nss) {
uow.commit();
}
}
+
Status renameCollection(OperationContext* opCtx,
const NamespaceString& source,
const NamespaceString& target) {
ASSERT_EQ(source.db(), target.db());
return renameCollection(opCtx, source, target, {});
}
+
Status truncateCollection(OperationContext* opCtx, const NamespaceString& nss) {
CollectionWriter coll(opCtx, nss);
return coll.getWritableCollection(opCtx)->truncate(opCtx);
@@ -92,8 +88,10 @@ Status truncateCollection(OperationContext* opCtx, const NamespaceString& nss) {
void insertRecord(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& data) {
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
OpDebug* const nullOpDebug = nullptr;
- ASSERT_OK(coll->insertDocument(opCtx, InsertStatement(data), nullOpDebug, false));
+ ASSERT_OK(collection_internal::insertDocument(
+ opCtx, coll, InsertStatement(data), nullOpDebug, false));
}
+
void assertOnlyRecord(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& data) {
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
auto cursor = coll->getCursor(opCtx);
@@ -104,11 +102,13 @@ void assertOnlyRecord(OperationContext* opCtx, const NamespaceString& nss, const
ASSERT(!cursor->next());
}
+
void assertEmpty(OperationContext* opCtx, const NamespaceString& nss) {
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
ASSERT(!coll->getCursor(opCtx)->next());
}
-bool indexExists(OperationContext* opCtx, const NamespaceString& nss, const string& idxName) {
+
+bool indexExists(OperationContext* opCtx, const NamespaceString& nss, const std::string& idxName) {
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
return coll->getIndexCatalog()->findIndexByName(
opCtx,
@@ -116,14 +116,16 @@ bool indexExists(OperationContext* opCtx, const NamespaceString& nss, const stri
IndexCatalog::InclusionPolicy::kReady |
IndexCatalog::InclusionPolicy::kUnfinished) != nullptr;
}
-bool indexReady(OperationContext* opCtx, const NamespaceString& nss, const string& idxName) {
+
+bool indexReady(OperationContext* opCtx, const NamespaceString& nss, const std::string& idxName) {
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
return coll->getIndexCatalog()->findIndexByName(
opCtx, idxName, IndexCatalog::InclusionPolicy::kReady) != nullptr;
}
+
size_t getNumIndexEntries(OperationContext* opCtx,
const NamespaceString& nss,
- const string& idxName) {
+ const std::string& idxName) {
size_t numEntries = 0;
auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss);
@@ -144,7 +146,7 @@ size_t getNumIndexEntries(OperationContext* opCtx,
return numEntries;
}
-void dropIndex(OperationContext* opCtx, const NamespaceString& nss, const string& idxName) {
+void dropIndex(OperationContext* opCtx, const NamespaceString& nss, const std::string& idxName) {
CollectionWriter coll(opCtx, nss);
auto desc =
coll.getWritableCollection(opCtx)->getIndexCatalog()->findIndexByName(opCtx, idxName);
@@ -152,6 +154,7 @@ void dropIndex(OperationContext* opCtx, const NamespaceString& nss, const string
ASSERT_OK(coll.getWritableCollection(opCtx)->getIndexCatalog()->dropIndex(
opCtx, coll.getWritableCollection(opCtx), desc));
}
+
} // namespace
template <bool rollback, bool defaultIndexes, bool capped>
@@ -163,7 +166,7 @@ public:
return;
}
- string ns = "unittests.rollback_create_collection";
+ std::string ns = "unittests.rollback_create_collection";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -200,7 +203,7 @@ public:
return;
}
- string ns = "unittests.rollback_drop_collection";
+ std::string ns = "unittests.rollback_drop_collection";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -481,7 +484,7 @@ template <bool rollback>
class CreateIndex {
public:
void run() {
- string ns = "unittests.rollback_create_index";
+ std::string ns = "unittests.rollback_create_index";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -492,7 +495,7 @@ public:
CollectionWriter coll(&opCtx, nss);
- string idxName = "a";
+ std::string idxName = "a";
BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v"
<< static_cast<int>(kIndexVersion));
@@ -523,7 +526,7 @@ template <bool rollback>
class DropIndex {
public:
void run() {
- string ns = "unittests.rollback_drop_index";
+ std::string ns = "unittests.rollback_drop_index";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -534,7 +537,7 @@ public:
CollectionWriter coll(&opCtx, nss);
- string idxName = "a";
+ std::string idxName = "a";
BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v"
<< static_cast<int>(kIndexVersion));
@@ -577,7 +580,7 @@ template <bool rollback>
class CreateDropIndex {
public:
void run() {
- string ns = "unittests.rollback_create_drop_index";
+ std::string ns = "unittests.rollback_create_drop_index";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -587,7 +590,7 @@ public:
AutoGetDb autoDb(&opCtx, nss.dbName(), MODE_X);
CollectionWriter coll(&opCtx, nss);
- string idxName = "a";
+ std::string idxName = "a";
BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v"
<< static_cast<int>(kIndexVersion));
@@ -621,7 +624,7 @@ template <bool rollback>
class CreateCollectionAndIndexes {
public:
void run() {
- string ns = "unittests.rollback_create_collection_and_indexes";
+ std::string ns = "unittests.rollback_create_collection_and_indexes";
const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
OperationContext& opCtx = *opCtxPtr;
NamespaceString nss(ns);
@@ -630,9 +633,9 @@ public:
Lock::DBLock dbXLock(&opCtx, nss.dbName(), MODE_X);
OldClientContext ctx(&opCtx, nss);
- string idxNameA = "indexA";
- string idxNameB = "indexB";
- string idxNameC = "indexC";
+ std::string idxNameA = "indexA";
+ std::string idxNameB = "indexB";
+ std::string idxNameC = "indexC";
BSONObj specA = BSON("key" << BSON("a" << 1) << "name" << idxNameA << "v"
<< static_cast<int>(kIndexVersion));
BSONObj specB = BSON("key" << BSON("b" << 1) << "name" << idxNameB << "v"
@@ -719,3 +722,4 @@ public:
OldStyleSuiteInitializer<All> all;
} // namespace RollbackTests
+} // namespace mongo
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index f1fa76d2bb9..cc054d253f7 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -27,13 +27,9 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <cstdint>
-
#include "mongo/db/catalog/clustered_collection_util.h"
-#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/collection_validation.h"
+#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
@@ -47,10 +43,8 @@
#include "mongo/dbtests/dbtests.h"
#include "mongo/dbtests/storage_debug_util.h"
+namespace mongo {
namespace ValidateTests {
-
-using std::unique_ptr;
-
namespace {
const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
@@ -208,7 +202,7 @@ protected:
bool _full;
bool _background;
const NamespaceString _nss;
- unique_ptr<AutoGetDb> _autoDb;
+ std::unique_ptr<AutoGetDb> _autoDb;
Database* _db;
};
@@ -232,11 +226,11 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2)), nullOpDebug, true));
wunit.commit();
}
releaseDb();
@@ -288,11 +282,11 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
wunit.commit();
}
@@ -354,13 +348,13 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "b" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "b" << 3)), nullOpDebug, true));
wunit.commit();
}
@@ -413,11 +407,11 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2)), nullOpDebug, true));
wunit.commit();
}
releaseDb();
@@ -498,10 +492,13 @@ public:
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc1), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc1), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc2), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc3), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc2), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc3), nullOpDebug, true));
wunit.commit();
}
releaseDb();
@@ -569,13 +566,13 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "b" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "b" << 1)), nullOpDebug, true));
wunit.commit();
}
@@ -628,15 +625,16 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(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(
+ ASSERT_OK(collection_internal::insertDocument(
&_opCtx,
+ coll(),
InsertStatement(BSON("_id" << 3 << "a" << BSON_ARRAY(-1 << -2 << -3))),
nullOpDebug,
true));
@@ -694,11 +692,12 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "x" << 1 << "a" << 2)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "x" << 1 << "a" << 2)),
+ nullOpDebug,
+ true));
wunit.commit();
}
@@ -753,23 +752,25 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 4)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 4)),
+ nullOpDebug,
+ true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 2 << "a" << 2 << "b" << 5)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 4 << "b" << 6)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 5 << "c" << 7)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 2 << "a" << 2 << "b" << 5)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 4 << "b" << 6)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 5 << "c" << 7)), nullOpDebug, true));
wunit.commit();
}
@@ -835,13 +836,13 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "b" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "b" << 1)), nullOpDebug, true));
wunit.commit();
}
@@ -966,16 +967,18 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 2 << "b" << BSON("0" << 1))),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 2 << "b" << BSON("0" << 1))),
+ nullOpDebug,
+ true));
wunit.commit();
}
releaseDb();
@@ -985,13 +988,15 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
&_opCtx,
+ coll(),
InsertStatement(BSON("_id" << 3 << "mk_1" << BSON_ARRAY(1 << 2 << 3))),
nullOpDebug,
true));
- ASSERT_OK(coll()->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
&_opCtx,
+ coll(),
InsertStatement(BSON("_id" << 4 << "mk_2" << BSON_ARRAY(BSON("e" << 1)))),
nullOpDebug,
true));
@@ -1086,30 +1091,35 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 2 << "a" << BSON("w" << 1))),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
&_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 2 << "a" << BSON("w" << 1))),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
InsertStatement(BSON("_id" << 3 << "a" << BSON_ARRAY("x" << 1))),
nullOpDebug,
true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 4 << "b" << 2)), nullOpDebug, true));
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 5 << "b" << BSON("y" << 1))),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 4 << "b" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
&_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 5 << "b" << BSON("y" << 1))),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
InsertStatement(BSON("_id" << 6 << "b" << BSON_ARRAY("z" << 1))),
nullOpDebug,
true));
@@ -1182,12 +1192,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -1276,12 +1286,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -1391,12 +1401,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -1486,21 +1496,24 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 2 << "a" << 3 << "b" << 3)),
- nullOpDebug,
- true));
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 3 << "a" << 6 << "b" << 6)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 2 << "a" << 3 << "b" << 3)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 3 << "a" << 6 << "b" << 6)),
+ nullOpDebug,
+ true));
wunit.commit();
}
releaseDb();
@@ -1660,12 +1673,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -1839,12 +1852,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 2 << "a" << 2)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 3 << "a" << 3)), nullOpDebug, true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -1977,8 +1990,8 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
wunit.commit();
}
@@ -1999,8 +2012,8 @@ public:
BSONObj dupObj = BSON("_id" << 2 << "a" << 1);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_NOT_OK(
- coll()->insertDocument(&_opCtx, InsertStatement(dupObj), nullOpDebug, true));
+ ASSERT_NOT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(dupObj), nullOpDebug, true));
}
releaseDb();
ensureValidateWorked();
@@ -2197,11 +2210,12 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
wunit.commit();
}
@@ -2234,8 +2248,8 @@ public:
BSONObj dupObj = BSON("_id" << 2 << "a" << 1 << "b" << 1);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_NOT_OK(
- coll()->insertDocument(&_opCtx, InsertStatement(dupObj), nullOpDebug, true));
+ ASSERT_NOT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(dupObj), nullOpDebug, true));
}
releaseDb();
ensureValidateWorked();
@@ -2437,11 +2451,12 @@ public:
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
rid1 = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -2475,8 +2490,8 @@ public:
BSONObj dupObj = BSON("_id" << 2 << "a" << 1 << "b" << 1);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_NOT_OK(
- coll()->insertDocument(&_opCtx, InsertStatement(dupObj), nullOpDebug, true));
+ ASSERT_NOT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(dupObj), nullOpDebug, true));
}
releaseDb();
ensureValidateWorked();
@@ -2768,7 +2783,8 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -2976,11 +2992,12 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << 1 << "a" << 1 << "b" << 1)),
+ nullOpDebug,
+ true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -3112,8 +3129,8 @@ public:
lockDb(MODE_X);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(
- &_opCtx, InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(BSON("_id" << 1 << "a" << 1)), nullOpDebug, true));
wunit.commit();
}
@@ -3122,8 +3139,8 @@ public:
BSONObj dupObj = BSON("_id" << 2 << "a" << 1);
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_NOT_OK(
- coll()->insertDocument(&_opCtx, InsertStatement(dupObj), nullOpDebug, true));
+ ASSERT_NOT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(dupObj), nullOpDebug, true));
}
releaseDb();
ensureValidateWorked();
@@ -3515,7 +3532,8 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -3739,7 +3757,8 @@ public:
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
_db->createCollection(&_opCtx, _nss);
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc1), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc1), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -3985,7 +4004,8 @@ public:
OpDebug* const nullOpDebug = nullptr;
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(coll()->insertDocument(&_opCtx, InsertStatement(doc1), nullOpDebug, true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx, coll(), InsertStatement(doc1), nullOpDebug, true));
id1 = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -4157,19 +4177,24 @@ public:
const OID firstRecordId = OID::gen();
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
+ nullOpDebug,
+ true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -4252,19 +4277,24 @@ public:
const OID firstRecordId = OID::gen();
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
+ nullOpDebug,
+ true));
rid = coll()->getCursor(&_opCtx)->next()->id;
wunit.commit();
}
@@ -4390,19 +4420,24 @@ public:
const OID firstRecordId = OID::gen();
{
WriteUnitOfWork wunit(&_opCtx);
- ASSERT_OK(
- coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
- nullOpDebug,
- true));
- ASSERT_OK(coll()->insertDocument(&_opCtx,
- InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
- nullOpDebug,
- true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << firstRecordId << "a" << 1)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 2)),
+ nullOpDebug,
+ true));
+ ASSERT_OK(collection_internal::insertDocument(
+ &_opCtx,
+ coll(),
+ InsertStatement(BSON("_id" << OID::gen() << "a" << 3)),
+ nullOpDebug,
+ true));
wunit.commit();
}
releaseDb();
@@ -4556,3 +4591,4 @@ public:
OldStyleSuiteInitializer<ValidateTests> validateTests;
} // namespace ValidateTests
+} // namespace mongo