samples/mongoose/index.js
function normalizeFields(fields) {
	const _fields = {};
	Object.keys(fields).forEach(k => {
		if (fields[k].constructor == Object && !fields[k].type) {
			_fields[k] = normalizeFields(fields[k]);
		} else {
			_fields[k] = 1;
		}
	});
	return _fields;
}
function normalizeFields(fields) {
	const _fields = {};
	Object.keys(fields).forEach(k => {
		if (fields[k].constructor == Object && !fields[k].type) {
			_fields[k] = normalizeFields(fields[k]);
		} else {
			_fields[k] = 1;
		}
	});
	return _fields;
}
function normalizeFields ( fields ) { const _fields = { } ; Object . keys ( fields ) . forEach ( k => { if ( fields [ k ] . constructor == Object && ! fields [ k ] . type ) { _fields [ k ] = normalizeFields ( fields [ k ] ) ; } else { _fields [ k ] = 1 ; } } ) ; return _fields ; }
Simply convert mongoose schema to nextql fields
Simply convert mongoose schema to nextql fields