nl_tokens: ********************************************************************** / * Private Methods ********************************************************************** Lookup the primary key for the given collection
pl_tokens: function _getPK ( connectionName , collectionName ) { var collectionDefinition ; try { collectionDefinition = connections [ connectionName ] . collections [ collectionName ] . definition ; var pk ; pk = _ . find ( <mask> . keys ( collectionDefinition ) , function _findPK ( key ) { var attrDef = collectionDefinition [ key ] ; if ( attrDef && attrDef . primaryKey ) return key ; else return false ; } ) ; if ( ! pk ) pk = 'id' ; return pk ; } catch ( e ) { throw new Error ( 'Unable to determine primary key for collection `' + collectionName + '` because ' + 'an error was encountered acquiring the collection definition:\n' + require ( 'util' ) . inspect ( e , false , null ) ) ; } }