Requesting clarification on the following question

Can someone please help me understand what is the difference between option B and option C? My understanding is, both of those are suggesting that we embed transactions in customers. They why is B shows incorrect and C as correct?

Thanks in advance.

1 Like

The material and the explanation of the answer do both seem to be poorly written and somewhat confusing.

I believe the intent in B. and C. is to differentiate between embedding subdocuments one after another in a document (B), and placing the subdocuments in an array (C) rather that just tossing them into the customer one after another.

C. is a cleaner structure and easier to write validation for.

First of all, thank you for the explanation. I have a bit of confusion. I cannot seem to imagine the document structure differently for option B and C. What I am thinking is like this for both options,

{
  "_id": ObjectId("customer_id"),
  "name": "Customer Name",
  "contactInfo": "Contact Information",
  "accountInfo": "Account Information",
  "transactions": [
    {
      "_id": ObjectId("transaction_id"),
      "amount": 100.00,
      "date": ISODate("2023-01-01T00:00:00Z"),
      // Other transaction-related fields
    },
    // Additional transactions
  ]
}

Can you please give me the one example for option B and C according to your understanding?

I see. However, won’t there be a possibility of the transactions array going out of bound? Considering that, option A seems best to me. Can you please explain this?

Thank you for your kind response and time.

1 Like

The example you give is “C” … you have an array of transactions.

The quiz is suggesting you either create an array of transactions or create paired documents for each customer, one consisting of the customer info, and the other of the customer transactions.

I am unable to create a sample document structure according to the option B of the question. Can you please give me an example of option B?

Thank you again.

It’s a little unclear what they’re trying to say in B … not terribly well written … but I believe they’re describing a messy antipattern where you create a document for each customer, with subdocuments for various customer information, then an array of transactions without a subdocument structure to each transaction.

Thank you so much.

I have read the About the MongoDB University Category topic with a hope that I may find a way report the question to the team which is maintaining the site.

I am hoping someone from MongoDB will see this; they will make the question and answer a bit more clear.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.