Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6006415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:32:09+00:00 2026-05-23T01:32:09+00:00

As i can see java mongo driver does not provide capability to get OutputStream

  • 0

As i can see java mongo driver does not provide capability to get OutputStream from existing gridFS file com.mongodb.gridfs.GridFSFile

I have to create GridFSInputFile directly or use gridFs.createFile() method.

Is it a lack of java driver or a restriction of gridfs ?

Could you suggest any workaround except create new file/delete old one ?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:32:10+00:00Added an answer on May 23, 2026 at 1:32 am

    GridFS is not a core feature of MongoDB but a convention of storing binary data with accompanying metadata. You should be able to modify any document in fs.chunks collection in a usual manner while keeping corresponding document in fs.files intact. The main problem will be recalculating MD5 checksum, but AFAIK it isn’t used anywhere and is just a “free” bonus. Anyway it’s still possible for appending-only modification (see MD5 digest of a resumed download).

    So to append to an existing GridFS file you need to locate corresponding document in fs.files. Then depending on last chunk filling ratio (length % chunkSize == 0) you either rewrite the last chunk document in fs.chunks respecting the chunkSize, and/or simply add new chunk(s) with incrementing n field. Next update length in fs.files and possibly other metadata.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While googling, I see that using java.io.File#length() can be slow. FileChannel has a size()
How do I set environment variables from Java? I see that I can do
In Java 1.4.2 and earlier versions, if you get a ClassCastException, you can see
How can i get the cookie contents from a URL in java ? Eg:
If you have used any decent java or .net IDE you can see the
all files in ~/Cipher/nsdl/crypto can be found here java files compiled with gcj, see
How can I see in Java if an Object is an array without using
I often use java.lang.Integer as primary key. Here you can see some piece of
I can see myself using Project Voldermort to cache results from a Traditional RDBMS
I managed (as you can see in older posts from me) to insert a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.