lib/pancakes.mongo.adapter.js
function getModel(resource) {
    var name = resource.name;

    // if not already in the model cache, get it
    if (!cache.models[name]) {
        var schema = new mongoose.Schema(resource.fields, { collection: name });

        // loop through indexes and add them to the schema
        _.each(resource.indexes, function (idx) {
            schema.index(idx.fields, idx.options);
        });

        cache.models[name] = mongoose.model(name, schema);
    }

    return cache.models[name];
}
function getModel(resource) {
    var name = resource.name;

    // if not already in the model cache, get it
    if (!cache.models[name]) {
        var schema = new mongoose.Schema(resource.fields, { collection: name });

        // loop through indexes and add them to the schema
        _.each(resource.indexes, function (idx) {
            schema.index(idx.fields, idx.options);
        });

        cache.models[name] = mongoose.model(name, schema);
    }

    return cache.models[name];
}
function getModel ( resource ) { var name = resource . name ; // if not already in the model cache, get it if ( ! cache . models [ name ] ) { var schema = new mongoose . Schema ( resource . fields , { collection : name } ) ; // loop through indexes and add them to the schema _ . each ( resource . indexes , function ( idx ) { schema . index ( idx . fields , idx . options ) ; } ) ; cache . models [ name ] = mongoose . model ( name , schema ) ; } return cache . models [ name ] ; }
Create a mongoose model object from a set of fields, fieldsets and indexes

@param resource
@returns {Model}
Create a mongoose model object from a set of fields fieldsets and indexes