index.js
/**
   * Creates a new object with the given data.
   *
   * @param  {Object} data
   * @return {Promise} Resolved with the new object or rejected with an error.
   */
Creates a new object with the given data.
@param  {Object} data
@return {Promise} Resolved with the new object or rejected with an error.
Creates a new object with the given data . @param { Object } data @return { Promise } Resolved with the new object or rejected with an error .
create (data) {
    const Model = this.model
    return (new Model(data)).save()
      .catch((err) => {
        const error = new Error('Invalid data')
        error.status = 400
        error.data = this.format(err.errors)
        throw error
      })
      .then(el => el._id)
  }
create ( data ) { const Model = this . model return ( new Model ( data ) ) . save ( ) . catch ( ( err ) => { const error = new Error ( 'Invalid data' ) error . status = 400 error . data = this . format ( err . errors ) throw error } ) . then ( el => el . _id ) }
Creates a new object with the given data.
Creates a new object with the given data .