0.0.7 • Published 4 years ago
mongo-easycrud v0.0.7
mongo-easycrud
library that make easy to do crud operations and validate the data sended using yup.
Enabled operations
- searchAll
- create
- update
- searchOne
- delete
searchAll
@param{*}
options = {
offset: int,
limit: int,
sort: array of <field, [ASC|DESC]>
filter: array of <field, value>
model: mongoose model,
validatorOut: yup schema
}
@returns
list of registers
- the yup schema 'validatorOut' is applied to each returned record
create
@param {*}
options = {
newValues: object with values to insert,
model: mongoose model,
validatorIn: yup schema,
validatorOut: yup schema }
@returns
record document inserted
- the yup schema 'validatorIn' is applied to the newValues object
- the yup schema 'validatorOut' is applied to the returned record
update
@param {*}
options = {
search: object with values to filter the update
newValues: object with values to insert,
model: mongoose model,
validatorIn: yup schema }
@returns
object { n: <int>, nModified: <int>, ok: <int>,}
searchOne
@param {*}
options = {
search: object with values to filter the update
model: mongoose model,
validatorOut: yup schema
}
@returns
register
- the yup schema 'validatorOut' is applied to the returned record
delete
@param{*}
options = {
search: object with values to filter the update
model: mongoose model
}
@returns
object { n: <int>, ok: <int>, deletedCount: <int> }