mongoose-bucket

1.0.0 • Public • Published

mongoose-bucket

Basic usage (setup)

MySchema = mongoose.Schema({
    parent_id: String,
});
 
MySchema.plugin(bucket, /* options */);

options

const options = {
    limit: 100, // number of items per bucket
    arrayName: 'bucket', // name of the array containing the subdocs
}

Basic usage (save to next bucket)

Callback

MySchema.bucketInsert(parent_id, newComment, function (err, parentDoc) {
 
})

Promise

MySchema.bucketInsert(parent_id, newComment)
    .then(parentDoc => {
 
    })
    .catch(error => {
 
    })

get (dev) going

  • nvm use
  • npm i
  • ??
  • npm run test

Package Sidebar

Install

npm i mongoose-bucket

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jaymc