Question: 1
Which of the following is a valid Replica Set configuration if you want:
1-Have 3 copies of everything
2- That RS3 is never primary
2- That RSI and RS2 can be primary?
You had to see the different configurations, RS3 could be hidden or priority 0 (But not a referee because we need
3 replicas), while RSI and RS2 could NOT have priority 0 or be hidden or anything like that
In a 4-member RS RSO , RSI, RS2 and RS3 + Referee, RSO (primary) falls after some write operations that have
replicated RSI and RS2 (but NOT RS3), who can get up as the new primary?
The configuration comes and in it we see that RS2 has a hidden: true (or a priority: 0, (I don't remember)
Question: 2
Which of the documents below will be retrieved by the following query? Assume the documents are stored in a collection called 'sample'. Check all that apply.
db.sample.find( { '$or' : [ { 'a' : { '$in' : [ 3, 10] > }, { 'b' : { '$lt' : 2 > > ] > )
A {''_ _id' : 3, 'a' : 4, 'c' : 0, 'b' : 14}
B {''_ Jd' : 7, 'a' : 8, 'c' : 1, 'b' : 7}
C {'. Jd' : 6, 'a' : 1, 'c' : 1, 'b' : 5}
D { ''\ Jd' : 9, 'a' : 17, 'c' : 1, 'b' : 1}
E { \ Jd' : 10,'a' : 3, 'c' : 1, 'b' : 1}
F {'. Jd' : : 2, 'a' : 2, 'c' : : 0, 'b' : 1}
G {'. Jd' : : 4, 'a' : 5, 'c' : : 0, 'b' : 17}
H {'. Jd' : : 1, 'a' : 0, 'c' : : 0, 'b' : 2}
I {'. Jd' : : 5, 'a' : 3, 'c' : : 0, 'b' : 12}
J {'. Jd' : : 8, 'a' : 11, 'c' : 1, 'b' : 0}
Answer : D, E, F, I, J
Show Answer
Hide Answer
Question: 3
Dada una coleccion, cuales devuelve con la siguiente query db.coleccion.find({nombre:'ruben',apellido:'gomez'},{nombre:l,apellido:l,aficion:l});
A { '-id' : Objectld('580a42b5dfblb5al7427d302'), 'nombre' : 'ruben', 'apellido' : 'gomez', 'aficion' : v u 'flipar' }
B { '_id' : Objectld('580a42acdfblb5al7427d301'), 'nombre' : 'Luis', 'apellido' : 'gomez', 'aficion' : u 'flipar' }
C { '_id' : Objectld('580a42acdfblb5al7427d301'), 'nombre' : 'ruben', 'apellido' : 'Pablo' , 'aficion' : u 'flipar'}
D { '_id' : Objectld('580a42acdfblb5al7427d301'), 'nombre' : 'ruben', 'apellido' : 'gomez' >
Answer : A, D
Show Answer
Hide Answer
Question: 4
What is the output of following two commands in MongoDB: db. posts. insert({n_id':l}) db.posts.insert({'_id':l})
Question: 5
Consider the following document:
> db.c.find()
{ '_id' : 12, b : [ 3, 5, 7, 2, 1, -4, 3, 12 ] }
Which of the following queries on the 'c' collection will return only the first five elements of the array in the 'b'
field? E.g.,
Document you want returned by your query:
{ '_id' : 12, 'b' : [ 3, 5, 7, 2, 1 ] >
A db.c.find( { > , { b : { $slice : [ 0 , 5 ] } } )
B db.c.find( { b : [ 0 , 5 ] > )
C db.c.find( { > , { b : { $substr[ 0 , 5 ] > > )
D db.c.find( { > , { b : [ 0, 1, 2, 3, 4, 5 ] > )
E db.c.find( { > , { b : [ 0 , 5 ] > )
Answer : A
Show Answer
Hide Answer