In the ctor of GridFS the following call on DBCollection#ensureIndex sets a wrong value respectively the wrong type for option "unique", so that the index will not be found even if it exists:
_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( "files_id" , 1 ).add( "n" , 1 ).get() , BasicDBObjectBuilder.start().add( "unique" , 1 ).get() );
The correct value would be true instead of 1:
_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( "files_id" , 1 ).add( "n" , 1 ).get() , BasicDBObjectBuilder.start().add( "unique" , true ).get() );
- related to
-
JAVA-401 "not master" MongoException when using GridFS with a direction connection to a secondary
- Closed