Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

notes and test for SERVER-3064

  • Loading branch information...
commit 8f6f0614bcf134352d3ff39fb136b9a9075efc21 1 parent 3ea739b
@erh erh authored
Showing with 30 additions and 2 deletions.
  1. +2 −2 db/query.cpp
  2. +28 −0 jstests/capped9.js
View
4 db/query.cpp
@@ -1084,8 +1084,8 @@ namespace mongo {
if ( ! (explain || pq.showDiskLoc()) && isSimpleIdQuery( query ) && !pq.hasOption( QueryOption_CursorTailable ) ) {
- NamespaceDetails* d = nsdetails(ns);
- uassert(14820, "capped collections have no _id index by default", !(d && d->capped));
+ NamespaceDetails* d = nsdetails(ns);
+ uassert(14820, "capped collections have no _id index by default", d == NULL || d->haveIdIndex() );
bool nsFound = false;
bool indexFound = false;
View
28 jstests/capped9.js
@@ -0,0 +1,28 @@
+
+t = db.capped9;
+t.drop();
+
+db.createCollection("capped9" , {capped:true, size:1024*50 });
+
+t.insert( { _id : 1 , x : 2 , y : 3 } )
+
+assert.eq( 1 , t.find( { x : 2 } ).itcount() , "A1" )
+assert.eq( 1 , t.find( { y : 3 } ).itcount() , "A2" )
+//assert.throws( function(){ t.find( { _id : 1 } ).itcount(); } , [] , "A3" ); // SERVER-3064
+
+t.update( { _id : 1 } , { $set : { y : 4 } } )
+//assert( db.getLastError() , "B1" ); // SERVER-3064
+//assert.eq( 3 , t.findOne().y , "B2" ); // SERVER-3064
+
+t.ensureIndex( { _id : 1 } )
+
+assert.eq( 1 , t.find( { _id : 1 } ).itcount() , "D1" )
+
+t.update( { _id : 1 } , { $set : { y : 4 } } )
+assert( null == db.getLastError() , "D1: " + tojson( db.getLastError() ) )
+assert.eq( 4 , t.findOne().y , "D2" )
+
+
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.