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-09-15 11:46:40 -0400
commit8d97af482910a484d61a94ca832047a6415b000c (patch)
tree241e05fa4398ff3e12ebc2085e8b4427c0123a13 /scripting
parente9c6dd49aeb28e3a694d366b3710668b11eaf601 (diff)
downloadmongo-8d97af482910a484d61a94ca832047a6415b000c.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 e6a6de94d72..e1788755042 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" ) );