I want to create a MongoDB database schema where objects have 2 array fields.I’m giving the example below
var playersdata = new mongoose.Schema({
footballplayerslist: {
players_name: String[], // all the players names goes here.
player_id: number[] // player id's goes here.
},
cricketplayerslist: {
players_name: String[], // all the players names goes here.
player_id: number[] // player id's goes here.
}
});
here, I want to create two objects like footballplayerslist & cricketplayerslist.In these objects, I want to two array fields as shown in the below code. I want to know whether my approach is correct or not & also my code is correct or not. I’m using the mean stack for coding part.