summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-07-13 09:27:56 -0400
committerMathias Stearn <mathias@10gen.com>2017-07-26 15:13:34 -0400
commit84ef4754b61003c63a480ac009fe2302970b00c9 (patch)
treea04948da01af49265a4ab366d79dc146b1e398a4 /src/mongo/scripting
parent8b36e1d65f4b1730e7fc6086a0e1f429e48ba695 (diff)
downloadmongo-84ef4754b61003c63a480ac009fe2302970b00c9.tar.gz
SERVER-28509 DBClientCursor now uses read commands
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/mozjs/mongo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp
index 859c6cddff4..4689325c5b5 100644
--- a/src/mongo/scripting/mozjs/mongo.cpp
+++ b/src/mongo/scripting/mozjs/mongo.cpp
@@ -289,6 +289,9 @@ void MongoBase::Functions::find::call(JSContext* cx, JS::CallArgs args) {
int batchSize = ValueWriter(cx, args.get(5)).toInt32();
int options = ValueWriter(cx, args.get(6)).toInt32();
+ // The shell only calls this method when it wants to test OP_QUERY.
+ options |= DBClientCursor::QueryOptionLocal_forceOpQuery;
+
std::unique_ptr<DBClientCursor> cursor(
conn->query(ns, q, nToReturn, nToSkip, haveFields ? &fields : NULL, options, batchSize));
if (!cursor.get()) {
@@ -505,7 +508,9 @@ void MongoBase::Functions::cursorFromId::call(JSContext* cx, JS::CallArgs args)
long long cursorId = NumberLongInfo::ToNumberLong(cx, args.get(1));
- auto cursor = stdx::make_unique<DBClientCursor>(conn, ns, cursorId, 0, 0);
+ // The shell only calls this method when it wants to test OP_GETMORE.
+ auto cursor = stdx::make_unique<DBClientCursor>(
+ conn, ns, cursorId, 0, DBClientCursor::QueryOptionLocal_forceOpQuery);
if (args.get(2).isNumber())
cursor->setBatchSize(ValueWriter(cx, args.get(2)).toInt32());