Answer the question
In order to leave comments, you need to log in
How to connect related documents?
there are two
artist.js files in shemas folder
'use strict';
var Mongoose = require('mongoose');
var categoryShema = require('category.js')
var artistSchema = new Mongoose.Schema({
id:{type: Number,required:true},
name:{type: String,required:true},
description: String,
created_at:{type:Date, default: Date.now},
category:{type:Schema.Types.ObjectId, ref: 'categoryModel'}
});
var artistModel = Mongoose.model('artist', artistSchema);
module.exports = artistModel;
'use strict';
var Mongoose = require('mongoose');
var categorySchema = new Mongoose.Schema({
id:{type: Number},
name:{type: String,required:true},
description:{type: String},
created_at:{type:Date, default: Date.now},
title:{type:String},
keywords:{type:String},
});
var categoryModel = Mongoose.model('category', categorySchema);
module.exports = categoryModel;
Error: Cannot find module 'category.js'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question