module:BaseModel()

new module:BaseModel()

Models Common Object. Models Objects could extends this Abstract Object Models (\Models\BaseModel) which means that Models Object will must be interact with some Mongoose Object Scheme, so, this Abstract Object Models handles with basics CRUD Models methods aside Mongoose Object Scheme for us. Specific Model Operations shouldnt be implemented here.

Methods

inner deleteByField(query) → {object}

Generic DeleteByField Method. Query this.Schema by query parameter. When the promise its resolved this method retrives a number of rows afected by findAndRemove action. Must be one because ID its unique.
Parameters:
Name Type Description
query object mongoose query object.
Returns:
object - Return a promise to who intend to delete data.

inner deleteById() → {object}

Generic DeleteById Method. Query this.Schema by identifier field. When the promise its resolved this method retrives a number of rows afected by findAndRemove action. Must be one because ID its unique.
Returns:
object - Return a promise to who intend to delete data.

inner findByIdList(query) → {object}

Generic FindByIdList Method. Query this.Schema by query parameter with $in arg.
Parameters:
Name Type Description
query object mongoose query object.
Returns:
object - Return a promise to who intend to find data.

inner getByField() → {object}

Generic GetByField Method. Query this.Schema by Data Object. When the promise is resolved this method retrieves the Object stored in MongoDB.
Returns:
object - Return a promise to who intend to retrives data.

inner getById() → {object}

Generic GetById Method. Query this.Schema by identifier field. When the promise is resolved this method retrieves the Object stored in MongoDB.
Returns:
object - Return a promise to who intend to retrieves data.

inner persist() → {object}

Generic Persist Method. Store the data property. When the promise is resolved this method retrieves the Object stored in MongoDB.
Returns:
object - Return a promise to who intent to save data.

inner removeByIdList(query) → {object}

Generic RemoveByIdList Method. Query this.Schema by query parameter with $in arg.
Parameters:
Name Type Description
query object mongoose query object.
Returns:
object - Return a promise to who intend to delete data.

inner updateByField(query) → {object}

Generic UpdateByField Method. Query this.Schema by query parameter. When this promise is resolved this method retrieves the Object update in MongoDB findAndRemove action. Must be one because ID its unique.
Parameters:
Name Type Description
query object mongoose query object.
Returns:
object - Return a promise to who intend to update data.

inner updateById() → {object}

Generic UpdateById Method. Query this.Schema by identifier field. When this promise is resolved this method retrieves the Object update in MongoDB.
Returns:
object - Return a promise to who intend to update data.