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-09-15 11:43:16 -0400
commitb777de943ff81cf86bc798196bf24e1225e3de65 (patch)
treef97778ded41d51cf6536e49ab7c863a88c87a425 /scripting
parent404e66bc8573035b67a1c27b90a3502324d9a72b (diff)
downloadmongo-b777de943ff81cf86bc798196bf24e1225e3de65.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 813e84770d5..8ba612ba6c8 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 ( ... ){