0.0.7 • Published 4 years ago

mongo-easycrud v0.0.7

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

mongo-easycrud

library that make easy to do crud operations and validate the data sended using yup.

Enabled operations

  1. searchAll
  2. create
  3. update
  4. searchOne
  5. 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> }
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago