summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-08-23 12:48:21 -0400
committerEliot Horowitz <eliot@10gen.com>2010-08-23 12:48:21 -0400
commit4910de3b195f9be1251036379493605a02917157 (patch)
treeaa2ac4c43832d3006d55020795cb8ed555596f5b /scripting
parent1c85bd156e9ce1fd8b25f421e1451d37cd66fde0 (diff)
downloadmongo-4910de3b195f9be1251036379493605a02917157.tar.gz
justOne for v8
Diffstat (limited to 'scripting')
-rw-r--r--scripting/v8_db.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripting/v8_db.cpp b/scripting/v8_db.cpp
index 5752fde6666..470414ff366 100644
--- a/scripting/v8_db.cpp
+++ b/scripting/v8_db.cpp
@@ -297,7 +297,7 @@ namespace mongo {
}
v8::Handle<v8::Value> mongoRemove(const v8::Arguments& args){
- jsassert( args.Length() == 2 , "remove needs 2 args" );
+ jsassert( args.Length() == 2 || args.Length() == 3 , "remove needs 2 args" );
jsassert( args[1]->IsObject() , "have to remove an object template" );
DBClientBase * conn = getConnection( args );
@@ -306,10 +306,15 @@ namespace mongo {
v8::Handle<v8::Object> in = args[1]->ToObject();
BSONObj o = v8ToMongo( in );
+ bool justOne = false;
+ if ( args.Length() > 2 ){
+ justOne = args[2]->BooleanValue();
+ }
+
DDD( "want to remove : " << o.jsonString() );
try {
v8::Unlocker u;
- conn->remove( ns , o );
+ conn->remove( ns , o , justOne );
}
catch ( ... ){
return v8::ThrowException( v8::String::New( "socket error on remove" ) );