summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2018-06-27 11:33:18 -0400
committerSara Golemon <sara.golemon@mongodb.com>2018-06-29 23:02:02 -0400
commit7d255086ddb335230b1373d5593e65cdc7ba45c3 (patch)
treed341ca4d62e080746ab8322f21e75e91e538cfd1 /src/mongo/client
parent821f9f69916da51f97e001b1c45dff6e49533f81 (diff)
downloadmongo-7d255086ddb335230b1373d5593e65cdc7ba45c3.tar.gz
SERVER-35847 Remove eval command and remove/update related tests/helpers
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/dbclient_base.cpp21
-rw-r--r--src/mongo/client/dbclient_base.h50
2 files changed, 0 insertions, 71 deletions
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index 2f756132c3f..d0ef3e0ea12 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -576,27 +576,6 @@ bool DBClientBase::copyDatabase(const string& fromdb,
return runCommand("admin", b.done(), *info);
}
-bool DBClientBase::eval(const string& dbname,
- const string& jscode,
- BSONObj& info,
- BSONElement& retValue,
- BSONObj* args) {
- BSONObjBuilder b;
- b.appendCode("$eval", jscode);
- if (args)
- b.appendArray("args", *args);
- bool ok = runCommand(dbname, b.done(), info);
- if (ok)
- retValue = info.getField("retval");
- return ok;
-}
-
-bool DBClientBase::eval(const string& dbname, const string& jscode) {
- BSONObj info;
- BSONElement retValue;
- return eval(dbname, jscode, info, retValue);
-}
-
list<BSONObj> DBClientBase::getCollectionInfos(const string& db, const BSONObj& filter) {
list<BSONObj> infos;
diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h
index 4b09d7bae37..141f41f880d 100644
--- a/src/mongo/client/dbclient_base.h
+++ b/src/mongo/client/dbclient_base.h
@@ -449,27 +449,6 @@ public:
const std::string& fromhost = "",
BSONObj* info = 0);
- /** Run javascript code on the database server.
- dbname database SavedContext in which the code runs. The javascript variable 'db' will be
- assigned to this database when the function is invoked.
- jscode source code for a javascript function.
- info the command object which contains any information on the invocation result
- including the return value and other information. If an error occurs running the
- jscode, error information will be in info. (try "log() << info.toString()")
- retValue return value from the jscode function.
- args args to pass to the jscode function. when invoked, the 'args' variable will be
- defined for use by the jscode.
-
- returns true if runs ok.
-
- See testDbEval() in dbclient.cpp for an example of usage.
- */
- bool eval(const std::string& dbname,
- const std::string& jscode,
- BSONObj& info,
- BSONElement& retValue,
- BSONObj* args = 0);
-
/** validate a collection, checking for errors and reporting back statistics.
this operation is slow and blocking.
*/
@@ -479,35 +458,6 @@ public:
return runCommand(nsGetDB(ns).c_str(), cmd, info);
}
- /* The following helpers are simply more convenient forms of eval() for certain common cases */
-
- /* invocation with no return value of interest -- with or without one simple parameter */
- bool eval(const std::string& dbname, const std::string& jscode);
- template <class T>
- bool eval(const std::string& dbname, const std::string& jscode, T parm1) {
- BSONObj info;
- BSONElement retValue;
- BSONObjBuilder b;
- b.append("0", parm1);
- BSONObj args = b.done();
- return eval(dbname, jscode, info, retValue, &args);
- }
-
- /** eval invocation with one parm to server and one numeric field (either int or double)
- * returned */
- template <class T, class NumType>
- bool eval(const std::string& dbname, const std::string& jscode, T parm1, NumType& ret) {
- BSONObj info;
- BSONElement retValue;
- BSONObjBuilder b;
- b.append("0", parm1);
- BSONObj args = b.done();
- if (!eval(dbname, jscode, info, retValue, &args))
- return false;
- ret = (NumType)retValue.number();
- return true;
- }
-
/**
* { name : "<short collection name>",
* options : { }