lykmapipo / mongoose-gridfs

mongoose gridfs on top of new gridfs api
MIT License
91 stars 39 forks source link

File with ID <xxxxxx> not opened for writing #30

Closed mkilp closed 6 years ago

mkilp commented 6 years ago

Hey there!

I'm using gridfs with mongoose and running into this error:

"name":"MongoError","message":"file with id 5adfc7a99b0e190f7aa9cd0a not opened for writing","driver":true

with this code:

db.User.findById(obj.api_token, function (err, user) {
        db.Attachment.readById(user.picture.id, function (error, buffer) {
            if(buffer)
            {
                callback(null, buffer);
            }
            else
            {
                callback(error, null);
            }
        })
    });

I made sure the file itself exists in the database and is available. Any idea how this happened?

Kind regards Nop0x

lykmapipo commented 6 years ago

@Nop0x Not sure. May you please add your scenario on the specs.