erlmongo icon indicating copy to clipboard operation
erlmongo copied to clipboard

Reading a file from gridfs which was written with an other client fails

Open ctradu opened this issue 10 years ago • 0 comments

Let there be a file on disk: /usr/local/.../094509-ac0c558a-6008-11e4-9a5d-e7ef2b7188c7.mp3

This file is uploaded using pymongo or using mongofiles. When I try to open it using erlmongo/gridfs using the following sequence:

Db1 = mongoapi:new("ouc3", "collection") Pid = mongoapi:gfsOpen(<<"fs">>, #gfs_file{filename = <<"/usr/local/.../094509-ac0c558a-6008-11e4-9a5d-e7ef2b7188c7.mp3">>}, Db1). Bin = mongoapi:gfsRead(Pid, 67248, Db1). => false

From what I see in the code the 5000 ms timeout is reached and false is returned.

Everything is fine when I try to do the same for a file written using the following sequence: Pid = Db:gfsNew(?REC_GFS_BUCKET, FilePath, [{}]), Db:gfsWrite(Pid, BinFile), Db:gfsClose(Pid),

Also, If I download the file using mongofiles and listen it (it is a wav in my case) it all goes fine. What I do not understand is why erlmongo fails to read those files

ctradu avatar Oct 31 '14 07:10 ctradu