Closed 360disrupt closed 7 years ago
gfs.remove(options, function (err) { if (err) return handleError(err); console.log('success'); });
let's assume that the callback only returns err but the callback returns also:
err
{ [Function: GridStore] define: Define { name: 'Gridstore', object: [Circular], stream: true, instrumentations: { 'callback=true,promise=true': [Object], 'callback=false,promise=false,returns=function Boolean() { [native code] }': [Object], 'callback=false,promise=false,returns=': [Object], 'callback=false,promise=false': [Object], 'callback=true,promise=false,returns=function (db, topology, dbName, name, pkFactory, options) {\n checkCollectionName(name);\n\n // Unpack variables\n var internalHint = null;\n var slaveOk = options == null || options.slaveOk == null ? db.slaveOk : options.slaveOk;\n var serializeFunctions = options == null || options.serializeFunctions == null ? db.s.options.serializeFunctions : options.serializeFunctions;\n var raw = options == null || options.raw == null ? db.s.options.raw : options.raw;\n var promoteLongs = options == null || options.promoteLongs == null ? db.s.options.promoteLongs : options.promoteLongs;\n var promoteValues = options == null || options.promoteValues == null ? db.s.options.promoteValues : options.promoteValues;\n var promoteBuffers = options == null || options.promoteBuffers == null ? db.s.options.promoteBuffers : options.promoteBuffers;\n var readPreference = null;\n var collectionHint = null;\n var namespace = f("%s.%s", dbName, name);\n\n // Get the promiseLibrary\n var promiseLibrary = options.promiseLibrary;\n\n // No promise library selected fall back\n if(!promiseLibrary) {\n promiseLibrary = typeof global.Promise == \'function\' ?\n global.Promise : require(\'es6-promise\').Promise;\n }\n\n // Assign the right collection level readPreference\n if(options && options.readPreference) {\n readPreference = options.readPreference;\n } else if(db.options.readPreference) {\n readPreference = db.options.readPreference;\n }\n\n // Set custom primary key factory if provided\n pkFactory = pkFactory == null\n ? ObjectID\n : pkFactory;\n\n // Internal state\n this.s = {\n // Set custom primary key factory if provided\n pkFactory: pkFactory\n // Db\n , db: db\n // Topology\n , topology: topology\n // dbName\n , dbName: dbName\n // Options\n , options: options\n // Namespace\n , namespace: namespace\n // Read preference\n , readPreference: readPreference\n // SlaveOK\n , slaveOk: slaveOk\n // Serialize functions\n , serializeFunctions: serializeFunctions\n // Raw\n , raw: raw\n // promoteLongs\n , promoteLongs: promoteLongs\n // promoteValues\n , promoteValues: promoteValues\n // promoteBuffers\n , promoteBuffers: promoteBuffers\n // internalHint\n , internalHint: internalHint\n // collectionHint\n , collectionHint: collectionHint\n // Name\n , name: name\n // Promise library\n , promiseLibrary: promiseLibrary\n // Read Concern\n , readConcern: options.readConcern\n }\n}': [Object], 'callback=true,promise=true,static=true': [Object] } }, DEFAULT_ROOT_COLLECTION: 'fs', DEFAULT_CONTENT_TYPE: 'binary/octet-stream', IO_SEEK_SET: 0, IO_SEEK_CUR: 1, IO_SEEK_END: 2, exist: [Function], list: [Function], read: [Function], readlines: [Function], unlink: [Function] }
The callback is important for control flow methods like async.waterfall. A better descritpion would be:
async.waterfall
gfs.remove(options, function (err, whatEveryIsReturnedHere) { if (err) return handleError(err); console.log('success'); });
Thanks, adjusted the docs
let's assume that the callback only returns
err
but the callback returns also:The callback is important for control flow methods like
async.waterfall
. A better descritpion would be: