Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Respect autoIndexId option, if set

  • Loading branch information...
commit 45667b3132dcc43204c7058d6db0ef997a053d52 1 parent 9dca132
Kristina authored August 02, 2012

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  src/mongo/db/pdfile.cpp
10  src/mongo/db/pdfile.cpp
@@ -313,12 +313,16 @@ namespace mongo {
313 313
         NamespaceDetails *d = nsdetails(ns);
314 314
         verify(d);
315 315
         
316  
-        // make an _id index for all colls, except capped ones in local w/o autoIndexID
317  
-        // (reason for the exception is for the oplog and non-replicated capped colls)
318 316
         bool ensure = true;
319  
-        if( newCapped && str::equals( nsToDatabase( ns ).c_str() ,  "local" ) ) {
  317
+
  318
+        // respect autoIndexId if set. otherwise, create an _id index for all colls, except for
  319
+        // capped ones in local w/o autoIndexID (reason for the exception is for the oplog and
  320
+        //  non-replicated capped colls)
  321
+        if( !options.getField( "autoIndexId" ).eoo() ||
  322
+            (newCapped && str::equals( nsToDatabase( ns ).c_str() ,  "local" )) ) {
320 323
             ensure = options.getField( "autoIndexId" ).trueValue();
321 324
         }
  325
+
322 326
         if( ensure ) {
323 327
             if( deferIdIndex )
324 328
                 *deferIdIndex = true;

0 notes on commit 45667b3

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