Search code examples
mongodbgridfsmongo-java

How to change bucket name in MongoDB GridFS?


I am using Mongo-Java-Driver 3.0.

How can i change bucket name from fs to new_name in MongoDB GridFS?


Solution

  • Use the bucket argument to the constructor, as documented in the Java GridFS API.

    GridFS(db, "new_name")

    Is this not working for you? If not, what happens? What's the error?