Skip to content

Commit 9bb29e7

Browse files
committed
JAVA-790: Change index options from {unique: 1} to {unique : true}
1 parent 4f04987 commit 9bb29e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/com/mongodb/gridfs/GridFS.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ public GridFS(DB db, String bucket) {
104104
_filesCollection.ensureIndex( BasicDBObjectBuilder.start().add( "filename" , 1 ).add( "uploadDate" , 1 ).get() );
105105
}
106106
if (_chunkCollection.count() < 1000) {
107-
_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( "files_id" , 1 ).add( "n" , 1 ).get() , BasicDBObjectBuilder.start().add( "unique" , 1 ).get() );
107+
_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( "files_id" , 1 ).add( "n" , 1 ).get() ,
108+
BasicDBObjectBuilder.start().add( "unique" , true ).get() );
108109
}
109110
} catch (MongoException e) {
110111
LOGGER.info(String.format("Unable to ensure indices on GridFS collections in database %s", db.getName()));

0 commit comments

Comments
 (0)