summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorSamantha Ritter <samantha.ritter@10gen.com>2015-03-26 14:31:58 -0400
committerSamantha Ritter <samantha.ritter@10gen.com>2015-03-30 14:45:19 -0400
commit465bb26c0fb0f4731f4dbb5e09e0a791177bbc64 (patch)
tree422da720a6289683e7dea7128113843ef0a246d6 /src/mongo/shell
parent06f4ea80a51ccea8da275e095cc5061707263957 (diff)
downloadmongo-465bb26c0fb0f4731f4dbb5e09e0a791177bbc64.tar.gz
SERVER-17453 eval command is deprecated
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/db.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 7be8562cca2..382b6b33fab 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -333,7 +333,7 @@ DB.prototype.help = function() {
print("\tdb.createUser(userDocument)");
print("\tdb.currentOp() displays currently executing operations in the db");
print("\tdb.dropDatabase()");
- print("\tdb.eval(func, args) run code server-side");
+ print("\tdb.eval() - deprecated");
print("\tdb.fsyncLock() flush data to disk and lock server for backups");
print("\tdb.fsyncUnlock() unlocks server following a db.fsyncLock()");
print("\tdb.getCollection(cname) same as db['cname'] or db.cname");
@@ -434,8 +434,9 @@ DB.prototype.setProfilingLevel = function(level,slowms) {
}
/**
+ * @deprecated
* <p> Evaluate a js expression at the database server.</p>
- *
+ *
* <p>Useful if you need to touch a lot of data lightly; in such a scenario
* the network transfer of the data could be a bottleneck. A good example
* is "select count(*)" -- can be done server side via this mechanism.
@@ -445,15 +446,17 @@ DB.prototype.setProfilingLevel = function(level,slowms) {
* If the eval fails, an exception is thrown of the form:
* </p>
* <code>{ dbEvalException: { retval: functionReturnValue, ok: num [, errno: num] [, errmsg: str] } }</code>
- *
+ *
* <p>Example: </p>
* <code>print( "mycount: " + db.eval( function(){db.mycoll.find({},{_id:ObjId()}).length();} );</code>
*
* @param {Function} jsfunction Javascript function to run on server. Note this it not a closure, but rather just "code".
* @return result of your function, or null if error
- *
+ *
*/
DB.prototype.eval = function(jsfunction) {
+ print("WARNING: db.eval is deprecated");
+
var cmd = { $eval : jsfunction };
if ( arguments.length > 1 ) {
cmd.args = argumentsToArray( arguments ).slice(1);