Skip to content

Instantly share code, notes, and snippets.

@miguelcperez
Last active July 9, 2018 15:04
Show Gist options
  • Save miguelcperez/44c01997dbc232b7b655141d5d928c4f to your computer and use it in GitHub Desktop.
Save miguelcperez/44c01997dbc232b7b655141d5d928c4f to your computer and use it in GitHub Desktop.
Mongo for Developers - Homework week 6
Homework 6.1
- Which of the following statements are true about replication in MongoDB? Check all that apply.
* The minimun sensible number of voting nodes to a replica set is three. True
* MongoDB replication is synchronous. False
* By default, using the new MongoClient connection class, w = 1, j = 1. False
* The oplog utilizes a capped collection. True
========================================================================================================================
Homework 6.2
- Let's suppose you have a five member replica set and want to assure that writes are committed to the journal and
are acknowledged by at least 3 nodes before you proceed forward. What would be the appropriate settings for w and j?
* w = 1, j = 1. Wrong
* w = "majority", j = 1. Correct
* w = 3, j = 0. Wrong
* w = 5, j = 1. Wrong
* w = 1, j = 3. Wrong
========================================================================================================================
Homework 6.3
- Which of the following statements are true about choosing and using a shard key?
* The shard key must be unique. False
* There must be a index on the collection that stars with the shard key. True
* MongoDB can not enforce unique indexes on a sharded collection other than the shard key itself,
or indexes prefixed by the shard key. True
* Any update that does not contain the shard key will be sent to all shards. True
* You can change the shard key on a collection if you desire. False
========================================================================================================================
Homework 6.4
- If you ran the query
> use school
> db.students.find({'student_id':2000})
Which shards would be involved in answering the query?
Answer: s1
========================================================================================================================
Homework 6.5
> python validate.py
Validate Code: kjvjkl3290mf0m20f2kjjv
========================================================================================================================
Like and Share with your friends.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment