nl_tokens: Update the dataset client
pl_tokens: function doUpdateDatasetClient ( datasetClientId , fields , upsert , cb ) { debug ( 'doUpdateDatasetClient datasetClientId = %s :: fields = %j' , datasetClientId , fields ) ; var col = mongoClient . collection ( DATASETCLIENTS_COLLECTION ) ; delete fields . _id ; col . findOneAndUpdate ( { id : datasetClientId } , { '$set' : fields } , { upsert : upsert , returnOriginal : false } , function ( err , result ) { if ( err ) { debugError ( 'Failed to update datasetClients due to error %s :: datasetClientId = %s :: fields = %j' , err , datasetClientId , fields ) ; return cb ( err ) ; } if ( result . value === null ) { return cb ( new <mask> ( 'DatasetClient not found for id ' + datasetClientId ) ) ; } //ensure the indexes are create for a given dataset ensureIndexesForDataset ( result . value . datasetId ) ; return cb ( null , result . value ) ; } ) ; }