Search test library by skills or roles
⌘ K

Adaface Sample MongoDB Questions

Here are some sample MongoDB questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Medium

Index key order
Solve
Consider the following indexes on "musk" collection and the written queries. Select the queries that will use an index:
 image
A) db.musk.find( { title : "SpaceX" } )
            B) db.musk.find( { _id : 22, date: ISODate("2020-01-01" } ) 
            C) db.musk.find( { date: ISODate("2020-01-01"), biz : "ElonSpaceX" } )
            D) db.musk.find( { contact : "111-111-1111"), info : "000-000-0000" } )

Medium

Unwind
Solve
Given the following movies document in MongoDB, What will be the output of the query:
 image

Medium

Indexing Sorting
Solve
Given the following sample document in Mongodb:
            
            { x: 5, y: 3, z: 2, w: 1 }
If the collection name is 'adaface' with a compound index { x: 1, y: 1, z: 1, w: 1}, which of the following queries will not use in-memory sorting?
 image

Hard

Replication and Sharding
Replication
Read Preferences
Failover
Solve
Consider a MongoDB setup where you have a replica set consisting of three members: Primary, Secondary, and Arbiter. A client's read preference is set to 'secondaryPreferred' to improve read performance during heavy load periods. Now, consider the following pseudo code snippet for a MongoDB script designed to insert documents into a collection 'orders':
const orderDocument = {
                orderId: '001',
                customerName: 'John Doe',
                product: 'Laptop',
                status: 'shipped'
            };
            db.orders.insert(orderDocument);
            
            const readResult = db.orders.find({}).readPref('secondaryPreferred');
            console.log(readResult);
Given this setup, which of the following statements is correct about the read and write operations performed? Take into account concepts like replication lag, read preference, network partitioning, and failover scenarios.
A: Write to secondary in sync.
            B: Primary always reads first.
            C: Reads prefer secondary.
            D: Arbiters store data.
            E: Lag affects secondary read.
            F: Arbiter handles writes.

Medium

Shard chunk
Solve
Read the following chunk and pick the correct statements that apply:
 image
A: The shard key defined for "sessions" collection is {userId: 1, sessionId: 1}
            B: All documents in chunk "test.sessions-abc-yxz" are located in shard "sh-1"
            C: Documents with fields {"userId": 10, "sessionId": "AB01" } are located part of chunk "test.sessions-abc-yxz"
🧐 Question🔧 Skill

Medium

Index key order

2 mins

MongoDB
Solve

Medium

Unwind

2 mins

MongoDB
Solve

Medium

Indexing Sorting

2 mins

MongoDB
Solve

Hard

Replication and Sharding
Replication
Read Preferences
Failover

2 mins

MongoDB
Solve

Medium

Shard chunk

3 mins

MongoDB
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Index key order
MongoDB
Medium2 mins
Solve
Unwind
MongoDB
Medium2 mins
Solve
Indexing Sorting
MongoDB
Medium2 mins
Solve
Replication and Sharding
Replication
Read Preferences
Failover
MongoDB
Hard2 mins
Solve
Shard chunk
MongoDB
Medium3 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1200+ companies in 80+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️