What happens if the GridFS file length is equal to the chunksize(not default) ?

55 views
Skip to first unread message

Nikethan G

unread,
Jan 11, 2017, 4:14:21 PM1/11/17
to mongodb-user
As per the Mongo documets, For files larger than chunk size, GridFS divides files into chunks of "chunkSize" with the exception of the last chunk. Similarly, files that are no larger than the chunk size only have a final chunk, using only as much space as needed plus some additional metadata.

What would happen if the chunk size and the file size are equal ? For instance, i have edited the chunksize to 10,000 and I have a file whose length is also 10,000 . What would happen in this scenario? 

Robert Stam

unread,
Jan 11, 2017, 8:02:23 PM1/11/17
to mongod...@googlegroups.com
When the file size is equal to the chunk size it takes exactly one full size chunk to store the file data.

On Wed, Jan 11, 2017 at 7:59 AM, Nikethan G <prabhu.n...@gmail.com> wrote:
As per the Mongo documets, For files larger than chunk size, GridFS divides files into chunks of "chunkSize" with the exception of the last chunk. Similarly, files that are no larger than the chunk size only have a final chunk, using only as much space as needed plus some additional metadata.

What would happen if the chunk size and the file size are equal ? For instance, i have edited the chunksize to 10,000 and I have a file whose length is also 10,000 . What would happen in this scenario? 

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/ef3df241-3eca-41a8-a3de-36d35809f1f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Stam

unread,
Jan 12, 2017, 8:41:59 AM1/12/17
to mongod...@googlegroups.com
What do you mean when you say "edit the chunksize"?

The chunk size can only be set when the GridFS file is being created. It cannot be changed afterwards. If you manually change the chunksize of an existing GridFS file all bets are off.
Reply all
Reply to author
Forward
0 new messages