1.0.0 • Published 7 years ago
mongoose-bucket v1.0.0
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
1.0.0
7 years ago