Which of the following are correct ways to define a reference in a Mongoose schema?
4 phương ánCó giải thíchDễ
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để định nghĩa một tham chiếu trong một schema Mongoose, bạn cần sử dụng thuộc tính 'ref' hoặc 'type' và 'ref'. Trong đó, 'ref' là tên của model mà bạn muốn tham chiếu. Ví dụ, nếu bạn muốn tham chiếu đến model 'User', bạn có thể sử dụng '{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }'. Điều này cho phép Mongoose tự động tạo ra mối quan hệ giữa các model.
Cùng chương 5
Which of the following are true about the match option in the populate() method? (Choose 2 answers)Có lời giảiCâu hỏiWhich of the following are valid options for the populate() method in Mongoose? (Choose 2 answers)Có lời giảiCâu hỏiWhich of the following methods are used to find and update a document in Mongoose? (Choose 2 answers)Có lời giảiCâu hỏiCả 34 câu của chủ đề34 câu