How to join databases in mongoDB and fetch the required result

Viewed 62

I have somewhat of the following type of database -

var school= mongoose.model('School' ,{
    name : { type : String, minlength : 1, trim : true },
    email : { type : String, trim : true },
    password : { type : String, minlength : 8, },
    mobile : { type : Number, minlength : true },
    address : { type : String },
    description : { type : String },
    student : { type : Array },
});

My site is home to many schools so the students should be able to see only the students of the same school. For this I have created a different table for the students and entering their unique values in the Student Array in School DB along with the respective student DB. How should I be able to fetch all the Student's data if i have student array from School DB.....

0 Answers
Related