Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

notes and test for SERVER-3064

  • Loading branch information...
commit 8f6f0614bcf134352d3ff39fb136b9a9075efc21 1 parent 3ea739b
Eliot erh authored

Showing 2 changed files with 30 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 db/query.cpp
  2. +28 0 jstests/capped9.js
4 db/query.cpp
@@ -1084,8 +1084,8 @@ namespace mongo {
1084 1084
1085 1085 if ( ! (explain || pq.showDiskLoc()) && isSimpleIdQuery( query ) && !pq.hasOption( QueryOption_CursorTailable ) ) {
1086 1086
1087   - NamespaceDetails* d = nsdetails(ns);
1088   - uassert(14820, "capped collections have no _id index by default", !(d && d->capped));
  1087 + NamespaceDetails* d = nsdetails(ns);
  1088 + uassert(14820, "capped collections have no _id index by default", d == NULL || d->haveIdIndex() );
1089 1089
1090 1090 bool nsFound = false;
1091 1091 bool indexFound = false;
28 jstests/capped9.js
... ... @@ -0,0 +1,28 @@
  1 +
  2 +t = db.capped9;
  3 +t.drop();
  4 +
  5 +db.createCollection("capped9" , {capped:true, size:1024*50 });
  6 +
  7 +t.insert( { _id : 1 , x : 2 , y : 3 } )
  8 +
  9 +assert.eq( 1 , t.find( { x : 2 } ).itcount() , "A1" )
  10 +assert.eq( 1 , t.find( { y : 3 } ).itcount() , "A2" )
  11 +//assert.throws( function(){ t.find( { _id : 1 } ).itcount(); } , [] , "A3" ); // SERVER-3064
  12 +
  13 +t.update( { _id : 1 } , { $set : { y : 4 } } )
  14 +//assert( db.getLastError() , "B1" ); // SERVER-3064
  15 +//assert.eq( 3 , t.findOne().y , "B2" ); // SERVER-3064
  16 +
  17 +t.ensureIndex( { _id : 1 } )
  18 +
  19 +assert.eq( 1 , t.find( { _id : 1 } ).itcount() , "D1" )
  20 +
  21 +t.update( { _id : 1 } , { $set : { y : 4 } } )
  22 +assert( null == db.getLastError() , "D1: " + tojson( db.getLastError() ) )
  23 +assert.eq( 4 , t.findOne().y , "D2" )
  24 +
  25 +
  26 +
  27 +
  28 +

0 comments on commit 8f6f061

Please sign in to comment.
Something went wrong with that request. Please try again.