From 10e82eae73630f53e13107e8aaabd17f846986f7 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 16 Oct 2009 15:33:56 -0400 Subject: [PATCH] remove muliple with _id range remove SERVER-365 --- client/dbclient.cpp | 2 +- jstests/remove3.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 jstests/remove3.js diff --git a/client/dbclient.cpp b/client/dbclient.cpp index 3b37d7be9c9..b84f3eb72db 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -549,7 +549,7 @@ namespace mongo { b.append( ns ); int flags = 0; - if ( justOne || obj.obj.hasField( "_id" ) ) + if ( justOne ) flags |= 1; b.append( flags ); diff --git a/jstests/remove3.js b/jstests/remove3.js new file mode 100644 index 00000000000..fe1a754583d --- /dev/null +++ b/jstests/remove3.js @@ -0,0 +1,18 @@ + +t = db.remove3; +t.drop(); + +for ( i=1; i<=8; i++){ + t.save( { _id : i , x : i } ); +} + +assert.eq( 8 , t.count() , "A" ); + +t.remove( { x : { $lt : 5 } } ); +assert.eq( 4 , t.count() , "B" ); + +t.remove( { _id : 5 } ); +assert.eq( 3 , t.count() , "C" ); + +t.remove( { _id : { $lt : 8 } } , "D" ); +assert.eq( 1 , t.count() , "D" );