这是SQL Server 2014中现有表的现有数据库架构。表之间存在一对多关系。
我试图为表创建一个mongodb模式。
如果在这种情况下我错了,谁能帮助我验证模式并纠正我:
index.js:
const Joi = require('joi');
const mongoose = require('mongoose');
const taxTagRelatedCountries = mongoose.model('TaxTagRelatedCountries', new mongoose.Schema({
taxTagId: {
type: number,
required: true
},
countryId: {
type: number
}
}));
const taxTagContents = mongoose.model('TaxTagContents', new mongoose.Schema({
displayName: {
type: String,
required: true
},
languageId: {
type: number,
required: true
}
}));
const taxTags = mongoose.model('TaxTags', new mongoose.Schema({
parentTagId: {
type: number,
default: null
},
isPublished: {
type: Boolean,
default: false
},
tagContents: [taxtagContentsSchema],
tagRelatedCountries: [taxTagRelatedCountries],
createdBy: {
type: String,
default: 'Admin'
},
createdDate: {
type: Date,
required: true,
default: Date.now
},
updatedBy: {
type: String,
default: 'Admin'
},
updatedDate: {
type: Date,
required: true,
default: Date.now
}
}));