summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2021-12-21 11:15:42 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-21 11:55:50 +0000
commit19080405d9c7d08b54e70228a92d237223f2885c (patch)
tree73748cedfa62252c21968fdd4d0290972bbf3641 /src/mongo/scripting
parent58ca93e30a6436f47a8e8eaa3ddc831e376965dc (diff)
downloadmongo-19080405d9c7d08b54e70228a92d237223f2885c.tar.gz
SERVER-61385 Migrate callers of 'DBClientBase::query()' legacy API to the modern 'find()' API
There are a handful of remaining callers of the legacy API, either using the exhaust option or which are involved in a code path which still relies on the OP_QUERY-inspired BSON format. These should be cleaned up as follow-up work.
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/engine.cpp4
-rw-r--r--src/mongo/scripting/mozjs/mongo.cpp16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index cc85b2f0f99..c7808f1a9f5 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -225,8 +225,8 @@ void Scope::loadStored(OperationContext* opCtx, bool ignoreNotConnected) {
auto directDBClient = DBDirectClientFactory::get(opCtx).create(opCtx);
- unique_ptr<DBClientCursor> c =
- directDBClient->query(coll, BSONObj{}, Query(), 0, 0, nullptr, QueryOption_SecondaryOk, 0);
+ std::unique_ptr<DBClientCursor> c = directDBClient->find(
+ FindCommandRequest{coll}, ReadPreferenceSetting{ReadPreference::SecondaryPreferred});
massert(16669, "unable to get db client cursor from query", c.get());
set<string> thisTime;
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp
index c519d55ed24..0c758aab00a 100644
--- a/src/mongo/scripting/mozjs/mongo.cpp
+++ b/src/mongo/scripting/mozjs/mongo.cpp
@@ -368,14 +368,14 @@ void MongoBase::Functions::find::call(JSContext* cx, JS::CallArgs args) {
int options = ValueWriter(cx, args.get(6)).toInt32();
const Query query = Query::fromBSONDeprecated(q);
- std::unique_ptr<DBClientCursor> cursor(conn->query(NamespaceString(ns),
- query.getFilter(),
- query,
- limit,
- nToSkip,
- haveFields ? &fields : nullptr,
- options,
- batchSize));
+ std::unique_ptr<DBClientCursor> cursor(conn->query_DEPRECATED(NamespaceString(ns),
+ query.getFilter(),
+ query,
+ limit,
+ nToSkip,
+ haveFields ? &fields : nullptr,
+ options,
+ batchSize));
if (!cursor.get()) {
uasserted(ErrorCodes::InternalError, "error doing query: failed");
}