packages/jollof/lib/data/modelizer.js
function identifyRefsInSchemaFields(structure, prefix) {

        _.each(structure.schema, (fieldStructure, fieldName) => {

            const name = prefix ? prefix + '.' + fieldName : fieldName;

            //If field has a schema, then it is a collection
            if (fieldStructure.schema) {

                // is this an object or an array?
                if (fieldStructure.meta && fieldStructure.meta.type === 'Array') {
                    //array
                    identifyRefsInSchemaFields(fieldStructure, name + '.*')
                } else {
                    //object. loop through schema.fields
                    identifyRefsInSchemaFields(fieldStructure, name)
                }

            } else if (fieldStructure.meta && fieldStructure.meta.ref) {
                //ref field found!
                refFields[name] = 1;
            }
        });


    }
function identifyRefsInSchemaFields(structure, prefix) {

        _.each(structure.schema, (fieldStructure, fieldName) => {

            const name = prefix ? prefix + '.' + fieldName : fieldName;

            //If field has a schema, then it is a collection
            if (fieldStructure.schema) {

                // is this an object or an array?
                if (fieldStructure.meta && fieldStructure.meta.type === 'Array') {
                    //array
                    identifyRefsInSchemaFields(fieldStructure, name + '.*')
                } else {
                    //object. loop through schema.fields
                    identifyRefsInSchemaFields(fieldStructure, name)
                }

            } else if (fieldStructure.meta && fieldStructure.meta.ref) {
                //ref field found!
                refFields[name] = 1;
            }
        });


    }
function identifyRefsInSchemaFields ( structure , prefix ) { _ . each ( structure . schema , ( fieldStructure , fieldName ) => { const name = prefix ? prefix + '.' + fieldName : fieldName ; //If field has a schema, then it is a collection if ( fieldStructure . schema ) { // is this an object or an array? if ( fieldStructure . meta && fieldStructure . meta . type === 'Array' ) { //array identifyRefsInSchemaFields ( fieldStructure , name + '.*' ) } else { //object. loop through schema.fields identifyRefsInSchemaFields ( fieldStructure , name ) } } else if ( fieldStructure . meta && fieldStructure . meta . ref ) { //ref field found! refFields [ name ] = 1 ; } } ) ; }
Identify all refs in the structure and store path names of ref fields
@param criteria
Identify all refs in the structure and store path names of ref fields