lib/manage/commands/find.js
function(doc, def, labelTemplate) {
	return Object.keys(doc)
		.map(key => {
			const field = doc[key]
			const fieldDef = def[key]

			if (!field || (!fieldDef && key != '_id')) {
				return null
			}

			const name = key == '_id' ? 'id' : fieldDef.label
			const template = labelTemplate || '%s'
			const label = util.format(template, name)

			if (typeof field == 'object' && !Array.isArray(field) && key != '_id') {
				return getDocumentOutput(field, fieldDef.schemaType, label + ' (%s)')
			}

			return `${chalk.yellow(label)}: ${field}`

		})
		.filter(line => { return line !== null })
		.join('\n')
}
function(doc, def, labelTemplate) {
	return Object.keys(doc)
		.map(key => {
			const field = doc[key]
			const fieldDef = def[key]

			if (!field || (!fieldDef && key != '_id')) {
				return null
			}

			const name = key == '_id' ? 'id' : fieldDef.label
			const template = labelTemplate || '%s'
			const label = util.format(template, name)

			if (typeof field == 'object' && !Array.isArray(field) && key != '_id') {
				return getDocumentOutput(field, fieldDef.schemaType, label + ' (%s)')
			}

			return `${chalk.yellow(label)}: ${field}`

		})
		.filter(line => { return line !== null })
		.join('\n')
}
function ( doc , def , labelTemplate ) { return Object . keys ( doc ) . map ( key => { const field = doc [ key ] const fieldDef = def [ key ] if ( ! field || ( ! fieldDef && key != '_id' ) ) { return null } const name = key == '_id' ? 'id' : fieldDef . label const template = labelTemplate || '%s' const label = util . format ( template , name ) if ( typeof field == 'object' && ! Array . isArray ( field ) && key != '_id' ) { return getDocumentOutput ( field , fieldDef . schemaType , label + ' (%s)' ) } return ` ${ chalk . yellow ( label ) } ${ field } ` } ) . filter ( line => { return line !== null } ) . join ( '\n' ) }
Get the string representation of the document
@param  {Object} doc
@param  {Object} def
@param  {String} [labelTemplate='%s']
@return {String}
Get the string representation of the document