logo

Crowdly

Browser

Додати до Chrome

Alice wants to create two collections in MongoDB called the unitEnrolment coll...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Alice wants to create two collections in MongoDB called the unitEnrolment collection and

the student collection. The relationship between the two collections is one-to-many. One

document in the unitEnrolment collection has many related documents in the student collection.

She wrote the following two MongoDB shell commands to populate the database:

db.unitEnrolment.insertOne({

"_id":1, "code":"FIT5148", "students":[1,2,3,4,5]

})

db.student.insertMany([

{"_id":1,"name":"Alita"},

{"_id":4,"name":"Nick"},

{"_id":5,"name":"Tom"}

])

Alice’s aggregation pipeline code produces the following output:

{"_id" : 1, "students" : 1, "details" : [{ "_id" : 1, "name" : "Alita" }]}

{"_id" : 1, "students" : 2, "details" : [ ] }

{"_id" : 1, "students" : 3, "details" : [ ] }

{"_id" : 1, "students" : 4, "details" : [ { "_id" : 4, "name" : "Nick" } ] }

{"_id" : 1, "students" : 5, "details" : [ { "_id" : 5, "name" : "Tom" } ] }

Which of the following aggregation query will produce the above output?

100%
0%
0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на learning.monash.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome