diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-23 12:48:21 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-23 12:48:21 -0400 |
commit | 4910de3b195f9be1251036379493605a02917157 (patch) | |
tree | aa2ac4c43832d3006d55020795cb8ed555596f5b /scripting | |
parent | 1c85bd156e9ce1fd8b25f421e1451d37cd66fde0 (diff) | |
download | mongo-4910de3b195f9be1251036379493605a02917157.tar.gz |
justOne for v8
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/v8_db.cpp | 9 |
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" ) ); |