diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-12-13 13:39:01 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-12-18 19:09:17 -0500 |
commit | 170e563e4cfa069f2128379e7b997e6777e0ee99 (patch) | |
tree | d4cbc8451e1ee33b120004a867bfcb25bfdca62d /src/mongo/db/pipeline/document_source.cpp | |
parent | 3e707bcd22b7c0e8275d25bf8e8b28c3cec4cc67 (diff) | |
download | mongo-170e563e4cfa069f2128379e7b997e6777e0ee99.tar.gz |
SERVER-11675 Agg text support
To enable this, Documents now can store "metadata" that gets carried though
the pipeline as long as the result is the same logical document. This includes
crossing the shard-to-merger boundary.
Diffstat (limited to 'src/mongo/db/pipeline/document_source.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source.cpp b/src/mongo/db/pipeline/document_source.cpp index 148bf4134d2..f07739479e3 100644 --- a/src/mongo/db/pipeline/document_source.cpp +++ b/src/mongo/db/pipeline/document_source.cpp @@ -84,6 +84,15 @@ namespace mongo { needId = true; continue; } + + if (str::startsWith(*it, '$')) { + if (*it == "$textScore") { + // textScore metadata + bb.append(Document::metaFieldTextScore, BSON("$meta" << "textScore")); + continue; + } + } + if (!last.empty() && str::startsWith(*it, last)) { // we are including a parent of *it so we don't need to include this field // explicitly. In fact, due to SERVER-6527 if we included this field, the parent @@ -92,6 +101,7 @@ namespace mongo { // prefixes. continue; } + last = *it + '.'; bb.append(*it, 1); } @@ -121,6 +131,12 @@ namespace mongo { string last; for (set<string>::const_iterator it(deps.begin()), end(deps.end()); it!=end; ++it) { + if (str::startsWith(*it, '$')) { + // documentFromBsonWithDeps doesn't handle meta data + if (*it == "$textScore") + return ParsedDeps(); + } + if (!last.empty() && str::startsWith(*it, last)) { // we are including a parent of *it so we don't need to include this field // explicitly. In fact, if we included this field, the parent wouldn't be fully |