Discussion:
How can i open a exist file to write in append mode?
gen liu
2011-09-20 06:04:36 UTC
Permalink
I want to open a exist file in append mode for writing new data.
But the GridFS API in java driver does't support it.
Please give me some suggestes, thanks?
Brendan W. McAdams
2011-09-20 06:49:30 UTC
Permalink
To the best of my knowledge the GridFS API doesn't support appending at all.
Post by gen liu
I want to open a exist file in append mode for writing new data.
But the GridFS API in java driver does't support it.
Please give me some suggestes, thanks?
--
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
Post by gen liu
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Gergely Nagy
2011-09-20 07:13:44 UTC
Permalink
Post by Brendan W. McAdams
To the best of my knowledge the GridFS API doesn't support appending at all.
While driver APIs might not expose the ability to append, technically,
it's still possible, and isn't even hard: add new chunks (don't need
to update the formerly last one, just add new chunks), update metadata
in files. Done.

The downside of this, is that the chunks for a given file will be
slightly inconsistent during the operation, as in, they will contain
more chunks than listed in fs.files. But assuming that drivers ignore
any chunks past the number specified in fs.files, this should not be
an issue.

(And on that note, I need to verify my driver works correctly in this case)
--
|8]
gen liu
2011-09-20 07:39:30 UTC
Permalink
Yes,i agree with you, and thanks for your reply.
As you mentioned "add new chunks (don't need to update the formerly
last one, just add new chunks)",
I think we best update from the last one ,then all the chunks will be
consistent.
I have read c# driver's Gridfs code. In the code, the c# driver assume
that all chunks have same size except the last one, when
java driver does't assume it.If we update from the last one, the java
driver client and the c# driver client can work well with each other.
Post by Gergely Nagy
Post by Brendan W. McAdams
To the best of my knowledge the GridFS API doesn't support appending at all.
While driver APIs might not expose the ability to append, technically,
it's still possible, and isn't even hard: add new chunks (don't need
to update the formerly last one, just add new chunks), update metadata
in files. Done.
The downside of this, is that the chunks for a given file will be
slightly inconsistent during the operation, as in, they will contain
more chunks than listed in fs.files. But assuming that drivers ignore
any chunks past the number specified in fs.files, this should not be
an issue.
(And on that note, I need to verify my driver works correctly in this case)
--
|8]
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Continue reading on narkive:
Loading...