-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.13.0
-
Component/s: GridFS
-
None
-
Environment:Linux
It counts on fs.files and fs.chunks every time to build index on collections when new a GridFS object.
Source code in com.mongodb.gridfs.GirdFS :
// ensure standard indexes as long as collections are small
try {
if (_filesCollection.count() < 1000)
if (_chunkCollection.count() < 1000)
{ _chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( "files_id" , 1 ).add( "n" , 1 ).get() , BasicDBObjectBuilder.start().add( "unique" , true ).get() ); }} catch (MongoException e)
{ LOGGER.info(String.format("Unable to ensure indices on GridFS collections in database %s", db.getName())); }I think it should check on the index exists ,not the row counts .
- duplicates
-
JAVA-389 Make GridFS index check/ensure less costly
- Closed