index.js
function(key, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var self = this;
      this._getCollection(function(err) {
        if(err) {
          done(err);
        }
        var kobj = {};
        kobj[self._key.getName()] = key;
        self._collection.find(kobj).toArray(function(err, docs) {
          var ret;
          if(!err && docs.length !== 0) {
            ret = docs[0];
          }
          self._collection.remove(kobj, function(err, result) {
            self._db.close();
            done(err, ret);
          });
        });
      });
    }
function(key, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var self = this;
      this._getCollection(function(err) {
        if(err) {
          done(err);
        }
        var kobj = {};
        kobj[self._key.getName()] = key;
        self._collection.find(kobj).toArray(function(err, docs) {
          var ret;
          if(!err && docs.length !== 0) {
            ret = docs[0];
          }
          self._collection.remove(kobj, function(err, result) {
            self._db.close();
            done(err, ret);
          });
        });
      });
    }
function ( key , done ) { if ( ! this . _key ) { done ( 'no key found for metadata' ) ; return ; } var self = this ; this . _getCollection ( function ( err ) { if ( err ) { done ( err ) ; } var kobj = { } ; kobj [ self . _key . getName ( ) ] = key ; self . _collection . find ( kobj ) . toArray ( function ( err , docs ) { var ret ; if ( ! err && docs . length !== 0 ) { ret = docs [ 0 ] ; } self . _collection . remove ( kobj , function ( err , result ) { self . _db . close ( ) ; done ( err , ret ) ; } ) ; } ) ; } ) ; }
Remove an item by key
@param  {String}   key  The key value
@param  {Function} done The callback when done
Remove an item by key