lib/schema.js
function Schema (obj, options) {
  if (!(this instanceof Schema))
    return new Schema(obj, options);

  this.paths = {};
  this.virtuals = {};
  this.callQueue = [];
  this._indexes = [];
  this.methods = {};
  this.statics = {};
  this.tree = {};
  this._requiredpaths = undefined;

  // set options
  this.options = utils.options({
      // safe: true
    strict: true
    , versionKey: '__v'
    , minimize: true
    , autoIndex: true
    // the following are only applied at construction time
    // , _id: true
    // , id: true
  }, options);

  // build paths
  if (obj) {
    this.add(obj);
  }
}
function Schema (obj, options) {
  if (!(this instanceof Schema))
    return new Schema(obj, options);

  this.paths = {};
  this.virtuals = {};
  this.callQueue = [];
  this._indexes = [];
  this.methods = {};
  this.statics = {};
  this.tree = {};
  this._requiredpaths = undefined;

  // set options
  this.options = utils.options({
      // safe: true
    strict: true
    , versionKey: '__v'
    , minimize: true
    , autoIndex: true
    // the following are only applied at construction time
    // , _id: true
    // , id: true
  }, options);

  // build paths
  if (obj) {
    this.add(obj);
  }
}
function Schema ( obj , options ) { if ( ! ( this instanceof Schema ) ) return new Schema ( obj , options ) ; this . paths = { } ; this . virtuals = { } ; this . callQueue = [ ] ; this . _indexes = [ ] ; this . methods = { } ; this . statics = { } ; this . tree = { } ; this . _requiredpaths = undefined ; // set options this . options = utils . options ( { // safe: true strict : true , versionKey : '__v' , minimize : true , autoIndex : true // the following are only applied at construction time // , _id: true // , id: true } , options ) ; // build paths if ( obj ) { this . add ( obj ) ; } }
Schema constructor.

####Example:

var child = new Schema({ name: String });
var schema = new Schema({ name: String, age: Number });
var Tree = mongoose.model('node', Tree', schema);

####Options:

- [safe](/docs/guide.html#safe): bool - defaults to true NOT IMPLEMENTED
- [strict](/docs/guide.html#strict): bool - defaults to true
- [capped](/docs/guide.html#capped): bool - defaults to false
- [versionKey](/docs/guide.html#versionKey): bool - defaults to "__v"
- [autoIndex](/docs/guide.html#autoIndex): bool - defaults to true
- `minimize`: bool - controls [document#toObject](#document_Document-toObject) behavior when called manually - defaults to true


@param {Object} definition
@inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter
@api public
Schema constructor .