MongoDB

MongoDB

Data Model Examples and Patterns has 9 Questions
Which of the following statement is incorrect about documents in MongoDB ?

The field names cannot start with the dollar sign ($) character
The field names cannot contain the dot (.) character
The field names cannot contain the null character
None of the mentioned
The ___________ JavaScript shell and the MongoDB language drivers translate between BSON and the language-specific document representation.

mongod
mongo
json
None of the mentioned
__________ define what records to select for read, update, and delete operations.

Query optimizer
Query selector
Update definitions
All of the mentioned
What would be the more optimal schema to embed the address data entities in the patron data for following schema representing one to many relationship ?
{
   _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"
} 


{

_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" }

]

} ?

{

_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" ]

]

} ?

{

_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" }

]

} ?

None of the mentioned
Point out the wrong statement :

Decisions that affect how you model data can affect application performance and database capacity
Collections do enforce document structure
Data in MongoDB has a flexible schema
None of the mentioned
How will avoid mutable, growing arrays in the following schema ?
{
   name: "O'Reilly Media",
   founded: 1980,
   location: "CA",
   books: [12346789, 234567890, ...]
}

{
    _id: 123456789,
    title: "MongoDB: The Definitive Guide",
    author: [ "Kristina Chodorow", "Mike Dirolf" ],
    published_date: ISODate("2010-09-24"),
    pages: 216,
    language: "English"
}

{
   _id: 234567890,
   title: "50 Tips and Tricks for MongoDB Developer",
   author: "Kristina Chodorow",
   published_date: ISODate("2011-05-06"),
   pages: 68,
   language: "English"
} 

{

_id: "oreilly",

name: "O'Reilly Media", founded: 1980, location: "CA"}

[ _id: 123456789,

title: "MongoDB: The Definitive Guide",

author: [ "Kristina Chodorow", "Mike Dirolf" ],

published_date: ISODate("2010-09-24"), pages: 216, language: "English", publisher_id: "oreilly"]

{ _id: 234567890, title: "50 Tips and Tricks for MongoDB Developer",

author: "Kristina Chodorow",

published_date: ISODate("2011-05-06"), pages: 68, language: "English", publisher_id: "oreilly"

}

{

_id: "oreilly",

name: "O'Reilly Media", founded: 1980, location: "CA"}

[ _id: 123456789, title: "MongoDB: The Definitive Guide",

author: [ "Kristina Chodorow", "Mike Dirolf" ],

published_date: ISODate("2010-09-24"), pages: 216, language: "English", publisher_id: "oreilly"]

[ _id: 234567890, title: "50 Tips and Tricks for MongoDB Developer",

author: "Kristina Chodorow",

published_date: ISODate("2011-05-06"), pages: 68, language: "English", publisher_id: "oreilly"

]

{

_id: "oreilly",

name: "O'Reilly Media", founded: 1980, location: "CA"}

{ _id: 123456789, title: "MongoDB: The Definitive Guide",

author: [ "Kristina Chodorow", "Mike Dirolf" ],

published_date: ISODate("2010-09-24"), pages: 216, language: "English", publisher_id: "oreilly"}

{ _id: 234567890, title: "50 Tips and Tricks for MongoDB Developer",

author: "Kristina Chodorow",

published_date: ISODate("2011-05-06"), pages: 68, language: "English", publisher_id: "oreilly"

}

None of the mentioned
Which of the following relationship uses references to describe documents between connected data ?

One-to-One Relationships with Embedded Documents
One-to-Many Relationships with Embedded Documents
One-to-Many Relationships with Document References
None of the mentioned
Point out the correct statement :

One-to-One Relationships with embedded documents presents a data model that uses embedded documents to describe one-to-one relationships between connected data
One-to-One Relationships with document references presents a data model that uses embedded documents to describe one-to-one relationships between connected data
One-to-Many Relationships with embedded documents presents a data model that uses embedded documents to describe one-to-one relationships between connected data
All of the mentioned
Which of the following is used to avoid repetition of data in MongoDB schema ?

DeReferences
References
Cursor
Collectors