mongoose-autosave

1.0.3 • Public • Published

Requirements

Plugin "mongoose-autopopulate"

How to install

npm install --save mongoose-autosave

For an example take a look @gd-com/examples !
const mongoose = require('mongoose')

var BookSchema = new mongoose.Schema({
    content: String,
    author: { type: mongoose.Schema.Types.ObjectId, ref: 'authors',  autopopulate: true }
})

BookSchema.plugin(require('mongoose-autopopulate'))
BookSchema.plugin(require('mongoose-autosave'))


var AuthorSchema = new mongoose.Schema({
    name: String
})


var Book = mongoose.model('books', BookSchema)
var Author = mongoose.model('authors', AuthorSchema)

module.exports = Book

License

This project is licensed under the MIT License - see the LICENSE file for details

Package Sidebar

Install

npm i mongoose-autosave

Weekly Downloads

2

Version

1.0.3

License

ISC

Unpacked Size

1.57 kB

Total Files

4

Last publish

Collaborators

  • ictuer