Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a few alternative methods for uploading and retrieving files in a Spring Boot application with MongoDB without relying on GridFSTemplate:

  1. Binary data: You can store your files as binary data in the database. However, this method is not recommended for larger files as it can cause performance issues.

  2. Use GridFS API: You can use the GridFS API directly instead of relying on GridFSTemplate. This can give you more control over the uploading and retrieving process.

  3. Store files in a file system: Instead of storing your files in the database, you can store them on the file system and use MongoDB to store metadata about the files such as name, size, and location.

  4. Use a third-party storage service: You can use a third-party storage service such as Amazon S3, Google Cloud Storage, or Azure Blob Storage to store your files and use MongoDB to store metadata about them. This approach can be more scalable and efficient for large files or heavy traffic.