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

Drive counts fs.chunks and fs.files every time when new GridFS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.13.0
    • Fix Version/s: None
    • Component/s: GridFS
    • Labels:
      None
    • Environment:
      Linux

      Description

      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)

      { _filesCollection.ensureIndex( BasicDBObjectBuilder.start().add( "filename" , 1 ).add( "uploadDate" , 1 ).get() ); }

      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 .

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: