diff options
author | Charlie Swanson <cswanson310@gmail.com> | 2015-06-24 10:03:42 -0400 |
---|---|---|
committer | Charlie Swanson <cswanson310@gmail.com> | 2015-06-24 18:18:18 -0400 |
commit | 0e9371dbed499f6f2ab5066fffdc746747351c6d (patch) | |
tree | 8a15fd87d8004fbcf324e02fe52586f8f509deab /src/mongo/db/pipeline/document_source_unwind.cpp | |
parent | 92750368e7a65031f4545d7c52ba268033b94a74 (diff) | |
download | mongo-0e9371dbed499f6f2ab5066fffdc746747351c6d.tar.gz |
SERVER-19105 Define macro for registering DocumentSources
Diffstat (limited to 'src/mongo/db/pipeline/document_source_unwind.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_unwind.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/mongo/db/pipeline/document_source_unwind.cpp b/src/mongo/db/pipeline/document_source_unwind.cpp index 8ec126b967c..efc6aaa13ee 100644 --- a/src/mongo/db/pipeline/document_source_unwind.cpp +++ b/src/mongo/db/pipeline/document_source_unwind.cpp @@ -111,13 +111,13 @@ boost::optional<Document> DocumentSourceUnwind::Unwinder::getNext() { return _output.peek(); } -const char DocumentSourceUnwind::unwindName[] = "$unwind"; - DocumentSourceUnwind::DocumentSourceUnwind(const intrusive_ptr<ExpressionContext>& pExpCtx) : DocumentSource(pExpCtx) {} +REGISTER_DOCUMENT_SOURCE(unwind, DocumentSourceUnwind::createFromBson); + const char* DocumentSourceUnwind::getSourceName() const { - return unwindName; + return "$unwind"; } boost::optional<Document> DocumentSourceUnwind::getNext() { @@ -151,7 +151,7 @@ DocumentSource::GetDepsReturn DocumentSourceUnwind::getDependencies(DepsTracker* void DocumentSourceUnwind::unwindPath(const FieldPath& fieldPath) { // Can't set more than one unwind path. - uassert(15979, str::stream() << unwindName << "can't unwind more than one path", !_unwindPath); + uassert(15979, "$unwind can't unwind more than one path", !_unwindPath); // Record the unwind path. _unwindPath.reset(new FieldPath(fieldPath)); _unwinder.reset(new Unwinder(fieldPath)); @@ -162,9 +162,7 @@ intrusive_ptr<DocumentSource> DocumentSourceUnwind::createFromBson( /* The value of $unwind should just be a field path. */ - uassert(15981, - str::stream() << "the " << unwindName << " field path must be specified as a string", - elem.type() == String); + uassert(15981, "the $unwind field path must be specified as a string", elem.type() == String); string prefixedPathString(elem.str()); string pathString(Expression::removeFieldPrefix(prefixedPathString)); |