summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2019-06-14 16:42:10 -0400
committerA. Jesse Jiryu Davis <jesse@mongodb.com>2019-06-14 19:23:18 -0400
commit47b380f03e8898f4706ff01fa2be64dfb72e0dba (patch)
treefb3508758c9abd0e297afee43ac847bf5aebcbbb /src/mongo/db/exec
parentb3c26131f6ab3f919beca658341e737de5d45683 (diff)
downloadmongo-47b380f03e8898f4706ff01fa2be64dfb72e0dba.tar.gz
SERVER-41071 Replace NULL and 0 with nullptr
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r--src/mongo/db/exec/collection_scan.cpp2
-rw-r--r--src/mongo/db/exec/fetch.cpp2
-rw-r--r--src/mongo/db/exec/filter.h8
-rw-r--r--src/mongo/db/exec/geo_near.cpp14
-rw-r--r--src/mongo/db/exec/geo_near.h3
-rw-r--r--src/mongo/db/exec/idhack.cpp2
-rw-r--r--src/mongo/db/exec/index_scan.cpp2
-rw-r--r--src/mongo/db/exec/merge_sort.h4
-rw-r--r--src/mongo/db/exec/multi_iterator.h2
-rw-r--r--src/mongo/db/exec/multi_plan.cpp6
-rw-r--r--src/mongo/db/exec/or.cpp2
-rw-r--r--src/mongo/db/exec/projection_exec.cpp4
-rw-r--r--src/mongo/db/exec/projection_exec.h2
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp61
-rw-r--r--src/mongo/db/exec/subplan.cpp10
-rw-r--r--src/mongo/db/exec/update_stage.cpp4
-rw-r--r--src/mongo/db/exec/update_stage.h2
-rw-r--r--src/mongo/db/exec/working_set.cpp2
-rw-r--r--src/mongo/db/exec/working_set_test.cpp11
19 files changed, 75 insertions, 68 deletions
diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp
index f416f8f3f9d..6a1e64dd30f 100644
--- a/src/mongo/db/exec/collection_scan.cpp
+++ b/src/mongo/db/exec/collection_scan.cpp
@@ -240,7 +240,7 @@ void CollectionScan::doReattachToOperationContext() {
unique_ptr<PlanStageStats> CollectionScan::getStats() {
// Add a BSON representation of the filter to the stats tree, if there is one.
- if (NULL != _filter) {
+ if (nullptr != _filter) {
BSONObjBuilder bob;
_filter->serialize(&bob);
_commonStats.filter = bob.obj();
diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp
index c8abe5fa26b..2e30f53e302 100644
--- a/src/mongo/db/exec/fetch.cpp
+++ b/src/mongo/db/exec/fetch.cpp
@@ -186,7 +186,7 @@ unique_ptr<PlanStageStats> FetchStage::getStats() {
_commonStats.isEOF = isEOF();
// Add a BSON representation of the filter to the stats tree, if there is one.
- if (NULL != _filter) {
+ if (nullptr != _filter) {
BSONObjBuilder bob;
_filter->serialize(&bob);
_commonStats.filter = bob.obj();
diff --git a/src/mongo/db/exec/filter.h b/src/mongo/db/exec/filter.h
index dea812de1a8..dcc079c9136 100644
--- a/src/mongo/db/exec/filter.h
+++ b/src/mongo/db/exec/filter.h
@@ -151,21 +151,21 @@ public:
* Returns false if 'wsm' does not satisfy the filter.
*/
static bool passes(WorkingSetMember* wsm, const MatchExpression* filter) {
- if (NULL == filter) {
+ if (nullptr == filter) {
return true;
}
WorkingSetMatchableDocument doc(wsm);
- return filter->matches(&doc, NULL);
+ return filter->matches(&doc, nullptr);
}
static bool passes(const BSONObj& keyData,
const BSONObj& keyPattern,
const MatchExpression* filter) {
- if (NULL == filter) {
+ if (nullptr == filter) {
return true;
}
IndexKeyMatchableDocument doc(keyData, keyPattern);
- return filter->matches(&doc, NULL);
+ return filter->matches(&doc, nullptr);
}
};
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp
index 27b04a5be73..5fa04b917db 100644
--- a/src/mongo/db/exec/geo_near.cpp
+++ b/src/mongo/db/exec/geo_near.cpp
@@ -80,14 +80,14 @@ namespace {
struct StoredGeometry {
static StoredGeometry* parseFrom(const BSONElement& element) {
if (!element.isABSONObj())
- return NULL;
+ return nullptr;
unique_ptr<StoredGeometry> stored(new StoredGeometry);
// GeoNear stage can only be run with an existing index
// Therefore, it is always safe to skip geometry validation
if (!stored->geometry.parseFromStorage(element, true).isOK())
- return NULL;
+ return nullptr;
stored->element = element;
return stored.release();
}
@@ -343,7 +343,7 @@ void GeoNear2DStage::DensityEstimator::buildIndexScan(OperationContext* opCtx,
IndexBoundsBuilder::intersectize(oil, &scanParams.bounds.fields[twoDFieldPosition]);
invariant(!_indexScan);
- _indexScan = new IndexScan(opCtx, scanParams, workingSet, NULL);
+ _indexScan = new IndexScan(opCtx, scanParams, workingSet, nullptr);
_children->emplace_back(_indexScan);
}
@@ -461,7 +461,7 @@ PlanStage::StageState GeoNear2DStage::initialize(OperationContext* opCtx,
invariant(_boundsIncrement > 0.0);
// Clean up
- _densityEstimator.reset(NULL);
+ _densityEstimator.reset(nullptr);
}
return state;
@@ -530,7 +530,7 @@ public:
unique_ptr<MatchExpression> shallowClone() const final {
MONGO_UNREACHABLE;
- return NULL;
+ return nullptr;
}
private:
@@ -897,7 +897,7 @@ void GeoNear2DSphereStage::DensityEstimator::buildIndexScan(OperationContext* op
// Index scan
invariant(!_indexScan);
- _indexScan = new IndexScan(opCtx, scanParams, workingSet, NULL);
+ _indexScan = new IndexScan(opCtx, scanParams, workingSet, nullptr);
_children->emplace_back(_indexScan);
}
@@ -1003,7 +1003,7 @@ PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* opCtx,
invariant(_boundsIncrement > 0.0);
// Clean up
- _densityEstimator.reset(NULL);
+ _densityEstimator.reset(nullptr);
}
return state;
diff --git a/src/mongo/db/exec/geo_near.h b/src/mongo/db/exec/geo_near.h
index 2fd2700db86..33295de7b39 100644
--- a/src/mongo/db/exec/geo_near.h
+++ b/src/mongo/db/exec/geo_near.h
@@ -47,7 +47,8 @@ namespace mongo {
* Generic parameters for a GeoNear search
*/
struct GeoNearParams {
- GeoNearParams() : filter(NULL), nearQuery(NULL), addPointMeta(false), addDistMeta(false) {}
+ GeoNearParams()
+ : filter(nullptr), nearQuery(nullptr), addPointMeta(false), addDistMeta(false) {}
// MatchExpression to apply to the index keys and fetched documents
// Not owned here, owned by solution nodes
diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp
index b54a9d06a52..8cd352fa046 100644
--- a/src/mongo/db/exec/idhack.cpp
+++ b/src/mongo/db/exec/idhack.cpp
@@ -58,7 +58,7 @@ IDHackStage::IDHackStage(OperationContext* opCtx,
_workingSet(ws),
_key(query->getQueryObj()["_id"].wrap()) {
_specificStats.indexName = descriptor->indexName();
- if (NULL != query->getProj()) {
+ if (nullptr != query->getProj()) {
_addKeyMetadata = query->getProj()->wantIndexKey();
}
}
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp
index 22c0cfe5898..f74743629bb 100644
--- a/src/mongo/db/exec/index_scan.cpp
+++ b/src/mongo/db/exec/index_scan.cpp
@@ -261,7 +261,7 @@ std::unique_ptr<PlanStageStats> IndexScan::getStats() {
// catalog information here.
// Add a BSON representation of the filter to the stats tree, if there is one.
- if (NULL != _filter) {
+ if (nullptr != _filter) {
BSONObjBuilder bob;
_filter->serialize(&bob);
_commonStats.filter = bob.obj();
diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h
index 6992214064b..5a25a3243cd 100644
--- a/src/mongo/db/exec/merge_sort.h
+++ b/src/mongo/db/exec/merge_sort.h
@@ -76,7 +76,7 @@ public:
private:
struct StageWithValue {
- StageWithValue() : id(WorkingSet::INVALID_ID), stage(NULL) {}
+ StageWithValue() : id(WorkingSet::INVALID_ID), stage(nullptr) {}
WorkingSetID id;
PlanStage* stage;
};
@@ -135,7 +135,7 @@ private:
// Parameters that must be provided to a MergeSortStage
class MergeSortStageParams {
public:
- MergeSortStageParams() : collator(NULL), dedup(true) {}
+ MergeSortStageParams() : collator(nullptr), dedup(true) {}
// How we're sorting.
BSONObj pattern;
diff --git a/src/mongo/db/exec/multi_iterator.h b/src/mongo/db/exec/multi_iterator.h
index 93eea472d0c..88dd5586ff7 100644
--- a/src/mongo/db/exec/multi_iterator.h
+++ b/src/mongo/db/exec/multi_iterator.h
@@ -63,7 +63,7 @@ public:
// Not used.
SpecificStats* getSpecificStats() const final {
- return NULL;
+ return nullptr;
}
// Not used.
diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp
index af79d91af30..fa5a3ded422 100644
--- a/src/mongo/db/exec/multi_plan.cpp
+++ b/src/mongo/db/exec/multi_plan.cpp
@@ -166,7 +166,7 @@ size_t MultiPlanStage::getTrialPeriodWorks(OperationContext* opCtx, const Collec
// Run each plan some number of times. This number is at least as great as
// 'internalQueryPlanEvaluationWorks', but may be larger for big collections.
size_t numWorks = internalQueryPlanEvaluationWorks.load();
- if (NULL != collection) {
+ if (nullptr != collection) {
// For large collections, the number of works is set to be this
// fraction of the collection size.
double fraction = internalQueryPlanEvaluationCollFraction;
@@ -307,7 +307,7 @@ Status MultiPlanStage::pickBestPlan(PlanYieldPolicy* yieldPolicy) {
// XXX: One known example is 2D queries
bool validSolutions = true;
for (size_t ix = 0; ix < solutions.size(); ++ix) {
- if (NULL == solutions[ix]->cacheData.get()) {
+ if (nullptr == solutions[ix]->cacheData.get()) {
LOG(5) << "Not caching query because this solution has no cache data: "
<< redact(solutions[ix]->toString());
validSolutions = false;
@@ -413,7 +413,7 @@ int MultiPlanStage::bestPlanIdx() const {
QuerySolution* MultiPlanStage::bestSolution() {
if (_bestPlanIdx == kNoSuchPlan)
- return NULL;
+ return nullptr;
return _candidates[_bestPlanIdx].solution.get();
}
diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp
index 965c972669d..8269b599f43 100644
--- a/src/mongo/db/exec/or.cpp
+++ b/src/mongo/db/exec/or.cpp
@@ -125,7 +125,7 @@ unique_ptr<PlanStageStats> OrStage::getStats() {
_commonStats.isEOF = isEOF();
// Add a BSON representation of the filter to the stats tree, if there is one.
- if (NULL != _filter) {
+ if (nullptr != _filter) {
BSONObjBuilder bob;
_filter->serialize(&bob);
_commonStats.filter = bob.obj();
diff --git a/src/mongo/db/exec/projection_exec.cpp b/src/mongo/db/exec/projection_exec.cpp
index bc2a4a42d65..505027adc61 100644
--- a/src/mongo/db/exec/projection_exec.cpp
+++ b/src/mongo/db/exec/projection_exec.cpp
@@ -166,7 +166,7 @@ void ProjectionExec::add(const string& field, bool include) {
ProjectionExec*& fm = _fields[subfield.c_str()];
- if (NULL == fm) {
+ if (nullptr == fm) {
fm = new ProjectionExec();
}
@@ -187,7 +187,7 @@ void ProjectionExec::add(const string& field, int skip, int limit) {
ProjectionExec*& fm = _fields[subfield.c_str()];
- if (NULL == fm) {
+ if (nullptr == fm) {
fm = new ProjectionExec();
}
diff --git a/src/mongo/db/exec/projection_exec.h b/src/mongo/db/exec/projection_exec.h
index 805be89ef44..ab4dc5f48dc 100644
--- a/src/mongo/db/exec/projection_exec.h
+++ b/src/mongo/db/exec/projection_exec.h
@@ -211,7 +211,7 @@ private:
*/
Status append(BSONObjBuilder* bob,
const BSONElement& elt,
- const MatchDetails* details = NULL,
+ const MatchDetails* details = nullptr,
const ArrayOpType arrayOpType = ARRAY_OP_NORMAL) const;
/**
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index a01bc911754..39ba8540c0f 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -184,7 +184,7 @@ public:
unique_ptr<WorkingSet> ws(new WorkingSet());
PlanStage* userRoot = parseQuery(opCtx, collection, planObj, ws.get(), &exprs);
- uassert(16911, "Couldn't parse plan from " + cmdObj.toString(), NULL != userRoot);
+ uassert(16911, "Couldn't parse plan from " + cmdObj.toString(), nullptr != userRoot);
// Add a fetch at the top for the user so we can get obj back for sure.
// TODO: Do we want to do this for the user? I think so.
@@ -200,7 +200,7 @@ public:
BSONObj obj;
PlanExecutor::ExecState state;
- while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) {
+ while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, nullptr))) {
resultBuilder.append(obj);
}
@@ -224,11 +224,11 @@ public:
std::vector<std::unique_ptr<MatchExpression>>* exprs) {
BSONElement firstElt = obj.firstElement();
if (!firstElt.isABSONObj()) {
- return NULL;
+ return nullptr;
}
BSONObj paramObj = firstElt.Obj();
- MatchExpression* matcher = NULL;
+ MatchExpression* matcher = nullptr;
BSONObj nodeArgs;
// Every node has these two fields.
@@ -239,7 +239,7 @@ public:
while (it.more()) {
BSONElement e = it.next();
if (!e.isABSONObj()) {
- return NULL;
+ return nullptr;
}
BSONObj argObj = e.Obj();
if (filterTag == e.fieldName()) {
@@ -252,12 +252,12 @@ public:
ExtensionsCallbackReal(opCtx, &collection->ns()),
MatchExpressionParser::kAllowAllSpecialFeatures);
if (!statusWithMatcher.isOK()) {
- return NULL;
+ return nullptr;
}
std::unique_ptr<MatchExpression> me = std::move(statusWithMatcher.getValue());
// exprs is what will wind up deleting this.
matcher = me.get();
- verify(NULL != matcher);
+ verify(nullptr != matcher);
exprs->push_back(std::move(me));
} else if (argsTag == e.fieldName()) {
nodeArgs = argObj;
@@ -265,7 +265,7 @@ public:
uasserted(16910,
"Unknown fieldname " + string(e.fieldName()) + " in query node " +
obj.toString());
- return NULL;
+ return nullptr;
}
}
@@ -323,8 +323,9 @@ public:
uassert(16922, "node of AND isn't an obj?: " + e.toString(), e.isABSONObj());
PlanStage* subNode = parseQuery(opCtx, collection, e.Obj(), workingSet, exprs);
- uassert(
- 16923, "Can't parse sub-node of AND: " + e.Obj().toString(), NULL != subNode);
+ uassert(16923,
+ "Can't parse sub-node of AND: " + e.Obj().toString(),
+ nullptr != subNode);
// takes ownership
andStage->addChild(subNode);
++nodesAdded;
@@ -346,8 +347,9 @@ public:
uassert(16925, "node of AND isn't an obj?: " + e.toString(), e.isABSONObj());
PlanStage* subNode = parseQuery(opCtx, collection, e.Obj(), workingSet, exprs);
- uassert(
- 16926, "Can't parse sub-node of AND: " + e.Obj().toString(), NULL != subNode);
+ uassert(16926,
+ "Can't parse sub-node of AND: " + e.Obj().toString(),
+ nullptr != subNode);
// takes ownership
andStage->addChild(subNode);
++nodesAdded;
@@ -366,11 +368,11 @@ public:
while (it.more()) {
BSONElement e = it.next();
if (!e.isABSONObj()) {
- return NULL;
+ return nullptr;
}
PlanStage* subNode = parseQuery(opCtx, collection, e.Obj(), workingSet, exprs);
uassert(
- 16936, "Can't parse sub-node of OR: " + e.Obj().toString(), NULL != subNode);
+ 16936, "Can't parse sub-node of OR: " + e.Obj().toString(), nullptr != subNode);
// takes ownership
orStage->addChild(subNode);
}
@@ -383,11 +385,12 @@ public:
parseQuery(opCtx, collection, nodeArgs["node"].Obj(), workingSet, exprs);
uassert(28731,
"Can't parse sub-node of FETCH: " + nodeArgs["node"].Obj().toString(),
- NULL != subNode);
+ nullptr != subNode);
return new FetchStage(opCtx, workingSet, subNode, matcher, collection);
} else if ("limit" == nodeName) {
- uassert(
- 16937, "Limit stage doesn't have a filter (put it on the child)", NULL == matcher);
+ uassert(16937,
+ "Limit stage doesn't have a filter (put it on the child)",
+ nullptr == matcher);
uassert(
16930, "Node argument must be provided to limit", nodeArgs["node"].isABSONObj());
uassert(16931, "Num argument must be provided to limit", nodeArgs["num"].isNumber());
@@ -395,18 +398,19 @@ public:
parseQuery(opCtx, collection, nodeArgs["node"].Obj(), workingSet, exprs);
uassert(28732,
"Can't parse sub-node of LIMIT: " + nodeArgs["node"].Obj().toString(),
- NULL != subNode);
+ nullptr != subNode);
return new LimitStage(opCtx, nodeArgs["num"].numberInt(), workingSet, subNode);
} else if ("skip" == nodeName) {
- uassert(
- 16938, "Skip stage doesn't have a filter (put it on the child)", NULL == matcher);
+ uassert(16938,
+ "Skip stage doesn't have a filter (put it on the child)",
+ nullptr == matcher);
uassert(16932, "Node argument must be provided to skip", nodeArgs["node"].isABSONObj());
uassert(16933, "Num argument must be provided to skip", nodeArgs["num"].isNumber());
PlanStage* subNode =
parseQuery(opCtx, collection, nodeArgs["node"].Obj(), workingSet, exprs);
uassert(28733,
"Can't parse sub-node of SKIP: " + nodeArgs["node"].Obj().toString(),
- NULL != subNode);
+ nullptr != subNode);
return new SkipStage(opCtx, nodeArgs["num"].numberInt(), workingSet, subNode);
} else if ("cscan" == nodeName) {
CollectionScanParams params;
@@ -443,7 +447,7 @@ public:
PlanStage* subNode = parseQuery(opCtx, collection, e.Obj(), workingSet, exprs);
uassert(16974,
"Can't parse sub-node of mergeSort: " + e.Obj().toString(),
- NULL != subNode);
+ nullptr != subNode);
// takes ownership
mergeStage->addChild(subNode);
}
@@ -466,7 +470,7 @@ public:
// that can only be checked for equality. We ignore this now.
Status s = fam->getSpec().getIndexPrefix(BSONObj(), &params.indexPrefix);
if (!s.isOK()) {
- return NULL;
+ return nullptr;
}
params.spec = fam->getSpec();
@@ -476,13 +480,14 @@ public:
params.query.setCaseSensitive(TextMatchExpressionBase::kCaseSensitiveDefault);
params.query.setDiacriticSensitive(TextMatchExpressionBase::kDiacriticSensitiveDefault);
if (!params.query.parse(fam->getSpec().getTextIndexVersion()).isOK()) {
- return NULL;
+ return nullptr;
}
return new TextStage(opCtx, params, workingSet, matcher);
} else if ("delete" == nodeName) {
- uassert(
- 18636, "Delete stage doesn't have a filter (put it on the child)", NULL == matcher);
+ uassert(18636,
+ "Delete stage doesn't have a filter (put it on the child)",
+ nullptr == matcher);
uassert(
18637, "node argument must be provided to delete", nodeArgs["node"].isABSONObj());
uassert(18638,
@@ -492,12 +497,12 @@ public:
parseQuery(opCtx, collection, nodeArgs["node"].Obj(), workingSet, exprs);
uassert(28734,
"Can't parse sub-node of DELETE: " + nodeArgs["node"].Obj().toString(),
- NULL != subNode);
+ nullptr != subNode);
auto params = std::make_unique<DeleteStageParams>();
params->isMulti = nodeArgs["isMulti"].Bool();
return new DeleteStage(opCtx, std::move(params), workingSet, collection, subNode);
} else {
- return NULL;
+ return nullptr;
}
}
};
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index 2506db606b1..889ea82428f 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -190,7 +190,7 @@ Status tagOrChildAccordingToCache(PlanCacheIndexTree* compositeCacheData,
invariant(compositeCacheData);
// We want a well-formed *indexed* solution.
- if (NULL == branchCacheData) {
+ if (nullptr == branchCacheData) {
// For example, we don't cache things for 2d indices.
str::stream ss;
ss << "No cache data for subchild " << orChild->debugString();
@@ -298,7 +298,7 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) {
// Check that we have good cache data. For example, we don't cache things
// for 2d indices.
- if (NULL == bestSoln->cacheData.get()) {
+ if (nullptr == bestSoln->cacheData.get()) {
str::stream ss;
ss << "No cache data for subchild " << orChild->debugString();
return Status(ErrorCodes::BadValue, ss);
@@ -343,7 +343,7 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) {
_compositeSolution =
QueryPlannerAnalysis::analyzeDataAccess(*_query, _plannerParams, std::move(solnRoot));
- if (NULL == _compositeSolution.get()) {
+ if (nullptr == _compositeSolution.get()) {
str::stream ss;
ss << "Failed to analyze subplanned query";
return Status(ErrorCodes::BadValue, ss);
@@ -487,11 +487,11 @@ unique_ptr<PlanStageStats> SubplanStage::getStats() {
}
bool SubplanStage::branchPlannedFromCache(size_t i) const {
- return NULL != _branchResults[i]->cachedSolution.get();
+ return nullptr != _branchResults[i]->cachedSolution.get();
}
const SpecificStats* SubplanStage::getSpecificStats() const {
- return NULL;
+ return nullptr;
}
} // namespace mongo
diff --git a/src/mongo/db/exec/update_stage.cpp b/src/mongo/db/exec/update_stage.cpp
index 34953bb62ff..7f079f27d9f 100644
--- a/src/mongo/db/exec/update_stage.cpp
+++ b/src/mongo/db/exec/update_stage.cpp
@@ -168,7 +168,7 @@ UpdateStage::UpdateStage(OperationContext* opCtx,
_ws(ws),
_idRetrying(WorkingSet::INVALID_ID),
_idReturning(WorkingSet::INVALID_ID),
- _updatedRecordIds(params.request->isMulti() ? new RecordIdSet() : NULL),
+ _updatedRecordIds(params.request->isMulti() ? new RecordIdSet() : nullptr),
_doc(params.driver->getDocument()) {
_children.emplace_back(child);
@@ -282,7 +282,7 @@ BSONObj UpdateStage::transformAndUpdate(const Snapshotted<BSONObj>& oldObj, Reco
}
// See if the changes were applied in place
- const char* source = NULL;
+ const char* source = nullptr;
const bool inPlace = _doc.getInPlaceUpdates(&_damages, &source);
if (inPlace && _damages.empty()) {
diff --git a/src/mongo/db/exec/update_stage.h b/src/mongo/db/exec/update_stage.h
index 93936166544..24beae7ffaa 100644
--- a/src/mongo/db/exec/update_stage.h
+++ b/src/mongo/db/exec/update_stage.h
@@ -47,7 +47,7 @@ struct PlanSummaryStats;
struct UpdateStageParams {
UpdateStageParams(const UpdateRequest* r, UpdateDriver* d, OpDebug* o)
- : request(r), driver(d), opDebug(o), canonicalQuery(NULL) {}
+ : request(r), driver(d), opDebug(o), canonicalQuery(nullptr) {}
// Contains update parameters like whether it's a multi update or an upsert. Not owned.
// Must outlive the UpdateStage.
diff --git a/src/mongo/db/exec/working_set.cpp b/src/mongo/db/exec/working_set.cpp
index e9dd0ac7e9c..79a0fbbcaa6 100644
--- a/src/mongo/db/exec/working_set.cpp
+++ b/src/mongo/db/exec/working_set.cpp
@@ -39,7 +39,7 @@ using std::string;
namespace dps = ::mongo::dotted_path_support;
-WorkingSet::MemberHolder::MemberHolder() : member(NULL) {}
+WorkingSet::MemberHolder::MemberHolder() : member(nullptr) {}
WorkingSet::MemberHolder::~MemberHolder() {}
WorkingSet::WorkingSet() : _freeList(INVALID_ID) {}
diff --git a/src/mongo/db/exec/working_set_test.cpp b/src/mongo/db/exec/working_set_test.cpp
index 9472c90fabe..eb8618552eb 100644
--- a/src/mongo/db/exec/working_set_test.cpp
+++ b/src/mongo/db/exec/working_set_test.cpp
@@ -52,12 +52,12 @@ protected:
id = ws->allocate();
ASSERT(id != WorkingSet::INVALID_ID);
member = ws->get(id);
- ASSERT(NULL != member);
+ ASSERT(nullptr != member);
}
void tearDown() {
ws.reset();
- member = NULL;
+ member = nullptr;
}
std::unique_ptr<WorkingSet> ws;
@@ -123,7 +123,7 @@ TEST_F(WorkingSetFixture, getFieldFromIndex) {
string secondName = "y";
int secondValue = 10;
- member->keyData.push_back(IndexKeyDatum(BSON(firstName << 1), BSON("" << firstValue), NULL));
+ member->keyData.push_back(IndexKeyDatum(BSON(firstName << 1), BSON("" << firstValue), nullptr));
// Also a minor lie as RecordId is bogus.
ws->transitionToRecordIdAndIdx(id);
BSONElement elt;
@@ -133,7 +133,8 @@ TEST_F(WorkingSetFixture, getFieldFromIndex) {
ASSERT_FALSE(member->getFieldDotted("foo", &elt));
// Add another index datum.
- member->keyData.push_back(IndexKeyDatum(BSON(secondName << 1), BSON("" << secondValue), NULL));
+ member->keyData.push_back(
+ IndexKeyDatum(BSON(secondName << 1), BSON("" << secondValue), nullptr));
ASSERT_TRUE(member->getFieldDotted(secondName, &elt));
ASSERT_EQUALS(elt.numberInt(), secondValue);
ASSERT_TRUE(member->getFieldDotted(firstName, &elt));
@@ -146,7 +147,7 @@ TEST_F(WorkingSetFixture, getDottedFieldFromIndex) {
string firstName = "x.y";
int firstValue = 5;
- member->keyData.push_back(IndexKeyDatum(BSON(firstName << 1), BSON("" << firstValue), NULL));
+ member->keyData.push_back(IndexKeyDatum(BSON(firstName << 1), BSON("" << firstValue), nullptr));
ws->transitionToRecordIdAndIdx(id);
BSONElement elt;
ASSERT_TRUE(member->getFieldDotted(firstName, &elt));