mongoose-autosave
v1.0.3
Published
Auto save ref props
Downloads
1
Readme
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