summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-08-22 00:52:06 -0400
committerEliot Horowitz <eliot@10gen.com>2010-08-22 00:52:06 -0400
commitfa8b9a8c734c673c62c447bfb1db8a497f2fa5d8 (patch)
tree07c3eb30db8ca5809d67b8dddd57205ec1308ad7 /scripting
parent6b9d67d4afc3ced5e9a55b57c9c4c66698d48d0f (diff)
downloadmongo-fa8b9a8c734c673c62c447bfb1db8a497f2fa5d8.tar.gz
shell support for justOne for removes SERVER-1653
Diffstat (limited to 'scripting')
-rw-r--r--scripting/sm_db.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripting/sm_db.cpp b/scripting/sm_db.cpp
index 4a359eb0510..b747d4fc13e 100644
--- a/scripting/sm_db.cpp
+++ b/scripting/sm_db.cpp
@@ -326,7 +326,7 @@ namespace mongo {
}
JSBool mongo_remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){
- smuassert( cx , "mongo_remove needs 2 arguments" , argc == 2 );
+ smuassert( cx , "mongo_remove needs 2 or 3 arguments" , argc == 2 || argc == 3 );
smuassert( cx , "2nd param to insert has to be an object" , JSVAL_IS_OBJECT( argv[1] ) );
Convertor c( cx );
@@ -340,9 +340,12 @@ namespace mongo {
string ns = c.toString( argv[0] );
BSONObj o = c.toObject( argv[1] );
-
+ bool justOne = false;
+ if ( argc > 2 )
+ justOne = c.toBoolean( argv[2] );
+
try {
- conn->remove( ns , o );
+ conn->remove( ns , o , justOne );
return JS_TRUE;
}
catch ( ... ){