Skip to content

Commit

Permalink
removed remove from Gridstore.close
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Dec 14, 2015
1 parent 1c2cf10 commit 80373f1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions lib/gridfs/grid_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,18 +497,14 @@ var close = function(self, callback) {

// Build the mongo object
if(self.uploadDate != null) {
files.remove({'_id':self.fileId}, self.writeConcern, function(err, collection) {
if(err && typeof callback == 'function') return callback(err);

buildMongoObject(self, function(err, mongoObject) {
if(err) {
if(typeof callback == 'function') return callback(err); else throw err;
}
buildMongoObject(self, function(err, mongoObject) {
if(err) {
if(typeof callback == 'function') return callback(err); else throw err;
}

files.save(mongoObject, options, function(err) {
if(typeof callback == 'function')
callback(err, mongoObject);
});
files.save(mongoObject, options, function(err) {
if(typeof callback == 'function')
callback(err, mongoObject);
});
});
} else {
Expand Down Expand Up @@ -913,7 +909,7 @@ var seek = function(self, position, seekLocation, callback) {
nthChunk(self, newChunkNumber, function(err, chunk) {
if(err) return callback(err, null);
if(chunk == null) return callback(new Error('no chunk found'));

// Set the current chunk
self.currentChunk = chunk;
self.position = targetPosition;
Expand Down

0 comments on commit 80373f1

Please sign in to comment.