summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-06-16 15:03:17 -0400
committerDavid Storch <david.storch@10gen.com>2016-06-16 17:38:22 -0400
commita090547438635509681d759b598623ff66a21d64 (patch)
tree028886c4671a33af3796152eda35ec7b4ff66e7f /src/mongo/db/commands
parent5f812b5da34f52835909f96d5061e4dce3c58d1f (diff)
downloadmongo-a090547438635509681d759b598623ff66a21d64.tar.gz
SERVER-24414 log deprecation warning when aggregate command is used without 'cursor' option
http://dochub.mongodb.org/core/aggregate-without-cursor-deprecation will contain the corresponding documentation.
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 0ff8ef7cfb7..47d116e343a 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -26,6 +26,8 @@
* it in the license file.
*/
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
+
#include "mongo/platform/basic.h"
#include <vector>
@@ -54,6 +56,7 @@
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/stdx/memory.h"
+#include "mongo/util/log.h"
namespace mongo {
@@ -300,6 +303,21 @@ public:
const bool isCursorCommand = !cmdObj["cursor"].eoo();
+ // Use of the aggregate command without specifying to use a cursor is deprecated.
+ // Applications should migrate to using cursors. Cursors are strictly more useful than
+ // outputting the results as a single document, since results that fit inside a single
+ // BSONObj will also fit inside a single batch.
+ //
+ // We occasionally log a deprecation warning.
+ if (!isCursorCommand) {
+ RARELY {
+ warning()
+ << "Use of the aggregate command without the 'cursor' "
+ "option is deprecated. See "
+ "http://dochub.mongodb.org/core/aggregate-without-cursor-deprecation.";
+ }
+ }
+
// If both explain and cursor are specified, explain wins.
if (pPipeline->isExplain()) {
result << "stages" << Value(pPipeline->writeExplainOps());