adplus-dvertising
frame-decoration

Question

What would be the more optimal schema to embed the address data entities in the patron data for following schema representing one to many relationships?
{
   _id: "joe",
   name: "Joe Bookreader"
}

{
   patron_id: "joe",
   street: "123 Fake Street",
   city: "Faketon",
   state: "MA",
   zip: "12345"
}

{
   patron_id: "joe",
   street: "1 Some Other Street",
   city: "Boston",
   state: "MA",
   zip: "12345"
} 

a.

{
_id: "joe",
name: "Joe Bookreader",
addresses: [
{
street: "123 Fake Street",
city: "Faketon",
state: "MA",
zip: "12345"
},
{
street: "1 Some Other Street",
city: "Boston",
state: "MA",
zip: "12345"
}
]
}

b.

{
_id: "joe",
name: "Joe Bookreader",
addresses: [
{
street: "123 Fake Street",
city: "Faketon",
state: "MA",
zip: "12345"
},
[
street: "1 Some Other Street",
city: "Boston",
state: "MA",
zip: "12345"
]
]
}

c.

{
_id: "joe",
name: "Joe Bookreader",
addresses: [
[
street: "123 Fake Street",
city: "Faketon",
state: "MA",
zip: "12345"
],
{
street: "1 Some Other Street",
city: "Boston",
state: "MA",
zip: "12345"
}
]
}

d.

None of the mentioned

Posted under MongoDB

Answer: (a).{
_id: "joe",
name: "Joe Bookreader",
addresses: [
{
street: "123 Fake Street",
city: "Faketon",
state: "MA",
zip: "12345"
},
{
street: "1 Some Other Street",
city: "Boston",
state: "MA",
zip: "12345"
}
]
}

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What would be the more optimal schema to embed the address data entities in the patron data for following schema representing one to many relationships?

Similar Questions

Discover Related MCQs

Q. __________ define what records to select for read, update, and delete operations.

Q. The ___________ JavaScript shell and the MongoDB language drivers translate between BSON and the language-specific document representation.

Q. Which of the following statement is incorrect about documents in MongoDB?

Q. The ________ References pattern stores each tree node in a document; in addition to the tree node, the document stores the id of the node’s parent.

Q. Point out the correct statement.

Q. The ________ Links pattern provides a simple solution to tree storage but requires multiple queries to retrieve subtrees.

Q. The _________ References pattern stores each tree node in array the id(s) of the node’s children.

Q. Point out the wrong statement.

Q. Which of the following pattern may provide a suitable solution for storing graphs?

Q. Which of the following pattern is more straightforward to use?

Q. The Array of Ancestors pattern is slightly slower than the ________________ pattern.

Q. The ____________ pattern identifies each node in the tree as stops in a round-trip traversal of the tree.

Q. ____________ pattern requires additional steps of working with strings and regular expressions.

Q. Which of the following pattern is best for static trees that do not change?

Q. Point out the correct statement.

Q. Which of the following operations are atomic on document level?

Q. ___________ bulk indexes may be more efficient for some kinds of content and workloads in real time.

Q. Point out the correct statement.

Q. ________ indexes can include any field whose value is a string or an array of string elements.

Q. Which of the following is related to document that do not provide a way to weight results?