-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 2.4
-
Component/s: GridFS
-
None
-
Environment:OS X Maverick
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I am using Gridfs for storing a big file in mongodb. This is my code to insert the file:
GridFS bigFile = new GridFS(db, "35"); File f = new File(path+"/element.son"); GridFSInputFile gfsFile = bigFile.createFile(f); gfsFile.setFilename("35"); gfsFile.save();
The file was successfully inserted intact, if I try to show it through the restful interface I had the follow response:
{ "offset" : 0, "rows": [ { "_id" : { "$oid" : "536ad33c300433edfe512724" }, "chunkSize" : 261120, "length" : 17647218, "md5" : "a86b60fb2d219d26b37256c89d1bb7f2", "filename" : "35", "contentType" : null, "uploadDate" : { "$date" : 1399509820201 }, "aliases" : null } ], "total_rows" : 1 , "query" : {} , "millis" : 0 }
Now, I want to delete this bucket, this is my code:
GridFS gridFs = new GridFS(db, "35"); GridFSDBFile fi = gridFs.findOne("35"); GridFSDBFile file = gridFs.findOne(new ObjectId(fi.getId().toString())); gridFs.remove(file);
Apparently the file has been deleted infact the response is:
{ "offset" : 0, "rows": [], "total_rows" : 0 , "query" : {} , "millis" : 0 }
but, if I show the collections in my console I have still my bucket (35.files,35.chunks).
Why after the remove in the console I have still this bucket? is it a bug or I haven't understood some stuff?