Reputation: 1
I am making a Todo List website with node.js and using mongoose database. In this database I have two two collecions,
Upvotes: 0
Views: 429
Reputation: 79
In user.js add:
module.exports = mongoose.model('User', userSchema)
const mongoose = require('mongoose')
const itemsSchema = {
name: String,
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}
}
Upvotes: 1