diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-10-25 15:46:22 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2014-01-21 12:55:49 -0500 |
commit | c9fc8a468e1fa9d6421ef35f5a23db0e0f014b4f (patch) | |
tree | 4eb8943cc3c29091db59d0d8c7b72ee43532fcff /src/mongo/db/pipeline/document_source_project.cpp | |
parent | d0037946dc103ffa648f7e8937f2c55351b03c53 (diff) | |
download | mongo-c9fc8a468e1fa9d6421ef35f5a23db0e0f014b4f.tar.gz |
SERVER-8033 Sharded agg should only send needed fields from shards to mongos
*** BEFORE ***
> db.foo.aggregate([{$sort: {score:1}}, {$limit: 10}, {$project: {_id: 1}}], {explain:true})
{
"splitPipeline" : {
"shardsPart" : [
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"limit" : NumberLong(10)
}
}
],
"mergerPart" : [
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"mergePresorted" : true,
"limit" : NumberLong(10)
}
},
{
"$project" : {
"_id" : true
}
}
]
},
"shards" : {
"shard0000" : {
"host" : "localhost:30001",
"stages" : [
{
"$cursor" : {
"query" : {
},
"indexOnly" : false,
"cursorType" : "BasicCursor"
}
},
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"limit" : NumberLong(10)
}
}
]
}
},
"ok" : 1
}
*** AFTER ***
> db.foo.aggregate([{$sort: {score:1}}, {$limit: 10}, {$project: {_id: 1}}], {explain:true})
{
"splitPipeline" : {
"shardsPart" : [
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"limit" : NumberLong(10)
}
},
{
"$project" : {
"score" : true,
"_id" : true
}
}
],
"mergerPart" : [
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"mergePresorted" : true,
"limit" : NumberLong(10)
}
},
{
"$project" : {
"_id" : true
}
}
]
},
"shards" : {
"shard0000" : {
"host" : "localhost:30001",
"stages" : [
{
"$cursor" : {
"query" : {
},
"fields" : {
"score" : 1,
"_id" : 1
},
"indexOnly" : false,
"cursorType" : "BasicCursor"
}
},
{
"$sort" : {
"sortKey" : {
"score" : 1
},
"limit" : NumberLong(10)
}
},
{
"$project" : {
"score" : true,
"_id" : true
}
}
]
}
},
"ok" : 1
}
Diffstat (limited to 'src/mongo/db/pipeline/document_source_project.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_project.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_project.cpp b/src/mongo/db/pipeline/document_source_project.cpp index 8ef3e1c6433..fdf9acc5b16 100644 --- a/src/mongo/db/pipeline/document_source_project.cpp +++ b/src/mongo/db/pipeline/document_source_project.cpp @@ -127,7 +127,7 @@ namespace mongo { pProject->_variables.reset(new Variables(idGenerator.getIdCount())); BSONObj projectObj = elem.Obj(); - pProject->_raw = projectObj.getOwned(); // probably not necessary, but better to be safe + pProject->_raw = projectObj.getOwned(); #if defined(_DEBUG) if (exprObj->isSimple()) { |