With gridfs, You can only put in a new file.
-----Original Message-----
From: Wachirawut Thamviset <
twac...@gmail.com>
Sender:
mongod...@googlegroups.com
Date: Sun, 5 Jun 2011 00:27:57
To: mongodb-user<
mongod...@googlegroups.com>
Reply-To:
mongod...@googlegroups.com
Subject: [mongodb-user] How can i update file's data in GridFS.?
First, I insert file "photo.jpg" to GridFS
// ---- example code ----
GridFS gfs = new GridFS(db);
GridFSInputFile f = gfs.createFile(new File("photo.jpg"));
f.save();
So, I can retrive that file by:
GridFS gfs = new GridFS(db);
GridFSDBFile f = gfs.findOne("photo.jpg");
But, if I have new file of "photo.jpg". How can I update (replace)
an old file.?
If I use this code again:
GridFS gfs = new GridFS(db);
GridFSInputFile f = gfs.createFile(new File("photo.jpg"));
f.save();
It will be a new record.
Thank.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to
mongod...@googlegroups.com.
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.