How should mongodb obtain subdocuments

  mongodb, question

There is such a collection:

const UserSchema = new Schema({
 name: {
 type: String,
 email: {
 type: String,
 password: {
 type: String,
 joinedRooms: [{
 type: ObjectId,
 ref: "Room",
 avatar: {
 type: String,
 default: "",

It is mainly operated by mongoose.

So if I want to get data from joinedRooms, there are two options:

Option 1:

The user’s document is obtained through the user’s _id, and the linked room data is obtained through the populate operation, thus obtaining all the details of the required joinedRooms.

Option 2:

The document of the user is obtained through the _id of the user, the array of joinedRooms is obtained, and then another request is made to search the collection of rooms and obtain all the data of the _id in the joinedRooms array, thus obtaining all the detailed information of the needed joinedRooms.

Which is better? How do you think about it in real work?

In addition, will the populate operation actually initiate another new database query?

The two methods are essentially the same, they are nothing more than whether you do it yourself or drive to help you do it. For convenience, I will choose option one.
The consideration in practical work is to avoid it as much as possible.joinOperations and how to avoid problems are discussed in the document:MongoDB Data Model Design. There is no explanation of the usage scenario here, so there is no way to analyze it concretely.