Mongoose Validation

This commit is contained in:
2020-07-13 20:15:03 +02:00
parent dfcb78f979
commit 59cc6c54cd
5 changed files with 153 additions and 132 deletions

View File

@@ -2,10 +2,22 @@ const mongoose = require("mongoose");
const restaurantSchema = mongoose.Schema({
_id: mongoose.Types.ObjectId,
name: String,
city: String,
imgUrl: String,
workingHours: String,
name: {
type: String,
required: true,
},
city: {
type: String,
required: true,
},
imgUrl: {
type: String,
required: true,
},
workingHours: {
type: String,
required: true,
},
hidden: Boolean,
dishes: [mongoose.Types.ObjectId],
});