docs: function () {
  
                  if (this.factory.schema) {
                      this.schema = this.factory.schema;
                      return;
                  }
                  var base = this.base;
  
                  while (base.factory.classof(Entity)) {
                      var baseSchema = base.schema;
                      for (var type in baseSchema) {
                          if (baseSchema.hasOwnProperty(type) && !this.schema.hasOwnProperty(type)) {
                              this.schema[type] = baseSchema[type];
                          }
                      }
                      base = base.base;
                  }
  
                  var schemaDefaults = {
                      required: true,
                      includeInIndex: false,
                      serverOnly: false,
                      _rewritten: true,
                      // if true, sub models get composed and not just linked
                      compose: false
                  }, schemaObject;
  
                  // add id schema
                  if (this.idField && !this.schema.hasOwnProperty(this.idField)) {
                      this.schema[this.idField] = {
                          type: String,
                          required: false,
                          serverOnly: false,
                          includeInIndex: true,
                          generated: true
                      };
                  }
  
                  if (this.updatedField && !this.schema.hasOwnProperty(this.updatedField)) {
                      this.schema[this.updatedField] = {
                          type: Date,
                          required: false,
                          serverOnly: false,
                          includeInIndex: true,
                          generated: true
                      };
                  }
  
                  if (this.createdField && !this.schema.hasOwnProperty(this.createdField)) {
                      this.schema[this.createdField] = {
                          type: Date,
                          required: false,
                          includeInIndex: true,
                          serverOnly: false,
                          generated: true
                      };
                  }
  
                  // rewrite schema
                  for (var key in this.schema) {
                      if (this.schema.hasOwnProperty(key)) {
                          schemaObject = this.schema[key];
                          if (_.isString(schemaObject) || schemaObject instanceof Array || schemaObject instanceof Function) {
                              schemaObject = {
                                  type: schemaObject
                              };
                              this.schema[key] = schemaObject;
                          }
                          if (_.isString(schemaObject.type)) {
                              schemaObject.type = require(schemaObject.type.replace(/\./g, "/"));
                          }
                          _.defaults(schemaObject, schemaDefaults);
                          schemaObject._key = key;
                      }
                  }
                  this.factory.schema = this.schema;
              }