lib/model.js
function constructor(attributes, options) {
      var hooks = []
        , local = {};

      options = options || {};

      //
      // Set the database name and/or urlRoot if provided in the options.
      //
      if (options.database) this.database = options.database;
      if (options.urlRoot) this.urlRoot = options.urlRoot;

      //
      // Copy attributes to a new object and provide a MongoDB OfbjectID.
      //
      attributes = attributes || {};
      for (var key in attributes) local[key] = attributes[key];

      //
      // If the provided `_id` is an ObjectID assume the model is stored.
      // If it is not an ObjectID, remove it from the provided data.
      // MongoDB will provide an ObjectID by default.
      //
      if ('_id' in local) try {
        local._id = new ObjectID(local._id);
      } catch (error) { delete local._id; }

      //
      // Define restricted non-enumerated properties.
      //
      predefine(this, fossa);

      //
      // Check for presence of before/after hooks and setup.
      //
      if (this.before) hooks.push('before');
      if (this.after) hooks.push('after');
      this.setup(hooks);

      //
      // Call original Backbone Model constructor.
      //
      backbone.Model.call(this, local, options);
    }
function constructor(attributes, options) {
      var hooks = []
        , local = {};

      options = options || {};

      //
      // Set the database name and/or urlRoot if provided in the options.
      //
      if (options.database) this.database = options.database;
      if (options.urlRoot) this.urlRoot = options.urlRoot;

      //
      // Copy attributes to a new object and provide a MongoDB OfbjectID.
      //
      attributes = attributes || {};
      for (var key in attributes) local[key] = attributes[key];

      //
      // If the provided `_id` is an ObjectID assume the model is stored.
      // If it is not an ObjectID, remove it from the provided data.
      // MongoDB will provide an ObjectID by default.
      //
      if ('_id' in local) try {
        local._id = new ObjectID(local._id);
      } catch (error) { delete local._id; }

      //
      // Define restricted non-enumerated properties.
      //
      predefine(this, fossa);

      //
      // Check for presence of before/after hooks and setup.
      //
      if (this.before) hooks.push('before');
      if (this.after) hooks.push('after');
      this.setup(hooks);

      //
      // Call original Backbone Model constructor.
      //
      backbone.Model.call(this, local, options);
    }
function constructor ( attributes , options ) { var hooks = [ ] , local = { } ; options = options || { } ; // // Set the database name and/or urlRoot if provided in the options. // if ( options . database ) this . database = options . database ; if ( options . urlRoot ) this . urlRoot = options . urlRoot ; // // Copy attributes to a new object and provide a MongoDB OfbjectID. // attributes = attributes || { } ; for ( var key in attributes ) local [ key ] = attributes [ key ] ; // // If the provided `_id` is an ObjectID assume the model is stored. // If it is not an ObjectID, remove it from the provided data. // MongoDB will provide an ObjectID by default. // if ( '_id' in local ) try { local . _id = new ObjectID ( local . _id ) ; } catch ( error ) { delete local . _id ; } // // Define restricted non-enumerated properties. // predefine ( this , fossa ) ; // // Check for presence of before/after hooks and setup. // if ( this . before ) hooks . push ( 'before' ) ; if ( this . after ) hooks . push ( 'after' ) ; this . setup ( hooks ) ; // // Call original Backbone Model constructor. // backbone . Model . call ( this , local , options ) ; }
Override default Model Constructor.

@Constructor
@param {Object} attributes
@param {Object} options
@api public
Override default Model Constructor .