Mongodb, how to build the merchant database schema?

  mongodb, question

To simplify, a shop generally has some similar attributes:
When operating on this schema, there is usually an account to access the routes in node.js

For example, the account name is shopName and the password is password.

But the reality is that a store can have several accounts, and the permissions between accounts will be different. For example, a bartender can only add one item to his account. The boss’s account authority can delete an order.

What is the general idea of this implementation in mongodb?

module.exports = function( mongoose) {
 var ShopSchema = new mongoose.Schema({
 shopName:     { type: String, unique: true },
 password:{type:String},
 address:     { type: String},
 location:{type:[Number],index: '2d'},
 shopPicUrl:      {type: String},
 shopPicTrueUrl:{type: String},
 mark:  { type: String},
 open:{type:Boolean},
 shopType:{type:String},
 
 dish:{type:[DishSchema]},
 
 order:{type:[{
 orderId:{type: String},
 date:{type: Date,default: Date.now},
 dish:{type: [DishSchema]},
 userId:{type: String}
 }]}
 
 });
 
 var DishSchema = new mongoose.Schema({
 dishName: { type: String},
 tags: { type: Array},
 price: { type: Number},
 intro: { type: String},
 dishPic:{ type: String},
 index:{type:Number},
 comment:{type:[{
 date:{type: Date,default: Date.now},
 userId:{type: String},
 content:{type: String}
 }]}
 });

The store is a separate account, and an array is created below to record the user name, password and login permissions.
{
shopname:XXXXX,
accouts:[
{

loginname:xxxx,
 password:xxxx,
 authority:[],

}]
}
Then create an index of accouts.loginname unique’s
When you use mongo, you think in mongo’s way. many ODM’s are still designed by ORM’s way of thinking. I prefer not to use them. Write json directly
Of course, you can plug the user’s details into the loginname layer, such as what the avatar introduces, and you can also build a table.