student Table
id-> user id
name-> user name
classId-> Class id
class Table
id-> Class id
name-> Class name
if I want to query the information of all the students and the class information they belong to, I can use mongodb"s join table query method $lookup
but many friends on the Internet say that the performance of mongodb is not good , so I think of a way
each time the student information is queried, the class table is queried according to classid, and then the data is returned. But in this way, if there are another 100 pieces of data, 200 queries will be made. It doesn"t look good either.
< H2 > Plan 2: < / H2 >I don"t know if there is such a way. First, query all the student, then take all the classId out and put them into the array, and then use the query method of the classsId in class table in mysql to query, so that only two queries are needed.
< H2 > which is more suitable? < / H2 >