diff options
author | Kristina <kristina@10gen.com> | 2012-08-02 14:41:10 -0400 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-08-02 14:41:10 -0400 |
commit | 45667b3132dcc43204c7058d6db0ef997a053d52 (patch) | |
tree | db813dada3fb80a83227be4f061c9e4b342cfebd /src/mongo/db | |
parent | 9dca13232a0578e30311f2f27bd150d83bb0b00d (diff) | |
download | mongo-45667b3132dcc43204c7058d6db0ef997a053d52.tar.gz |
Respect autoIndexId option, if set
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/pdfile.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp index 1f0f0ffeb5c..492fc62c77f 100644 --- a/src/mongo/db/pdfile.cpp +++ b/src/mongo/db/pdfile.cpp @@ -313,12 +313,16 @@ namespace mongo { NamespaceDetails *d = nsdetails(ns); verify(d); - // make an _id index for all colls, except capped ones in local w/o autoIndexID - // (reason for the exception is for the oplog and non-replicated capped colls) bool ensure = true; - if( newCapped && str::equals( nsToDatabase( ns ).c_str() , "local" ) ) { + + // respect autoIndexId if set. otherwise, create an _id index for all colls, except for + // capped ones in local w/o autoIndexID (reason for the exception is for the oplog and + // non-replicated capped colls) + if( !options.getField( "autoIndexId" ).eoo() || + (newCapped && str::equals( nsToDatabase( ns ).c_str() , "local" )) ) { ensure = options.getField( "autoIndexId" ).trueValue(); } + if( ensure ) { if( deferIdIndex ) *deferIdIndex = true; |