Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-790

Wrong type for option 'unique' in GridFS constructor

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.11.3, 3.0.0
    • Affects Version/s: 2.10.1
    • Component/s: GridFS
    • Labels:
      None
    • Environment:
      using mongodb-linux-x86_64-2.4.0

      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() );
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            rre Rainer Reich
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: