Suppose you have the following index on a routes collection: db.routes.createIndex( { airplane: 1, src_airport: 1, dst_airport: 1, stops: 1 } ) Which of the following queries will be able to use this index for sorting. Check all that apply.
Given the following example document from an artists collection: { _id: 5, last_name: 'Maurer', first_name: 'Alfred', year_born: 1868, year_died: 1932, nationality: 'USA' } and the following index: db.artists.createIndex( { "last_name": 1, "nationality": 1 } ) How MongoDB will handle the query below?
db.artists.find( { "last_name": /^B./, "nationality": 'France' } )
In your database there is a collection named sales with the following document structure: { _id: ObjectId("5bd761dcae323e45a93ccfe8"), saleDate: ISODate("2015-03-23T21:06:49.506Z"), items: [ { name: 'printer paper', tags: [ 'office', 'stationary' ], price: Decimal128("40.01"), quantity: 2 }, { name: 'notepad', tags: [ 'office', 'writing', 'school' ], price: Decimal128("35.29"), quantity: 2 }, { name: 'pens', tags: [ 'writing', 'school', 'stationary' ], price: Decimal128("56.12"), quantity: 5 } ], storeLocation: 'Denver', customer: { gender: 'M', age: 42, email: '[email protected]', satisfaction: 4 }, purchaseMethod: 'Online' } { _id: ObjectId("5bd761dcae323e45a93ccfe9"), saleDate: ISODate("2015-08-25T10:01:02.918Z"), items: [ { name: 'binder', tags: [ 'school', 'general', 'organization' ], price: Decimal128("28.31"), quantity: 9 }, { name: 'backpack', tags: [ 'school', 'travel', 'kids' ], price: Decimal128("83.28"), quantity: 2 } ], storeLocation: 'Seattle', customer: { gender: 'M', age: 50, email: '[email protected]', satisfaction: 5 }, couponUsed: false, purchaseMethod: 'Phone' } How can you extract all documents from this collection where the first tag in the tags field (Array) is 'office' in at least one item?
Select true statement regarding to the MongoDB Atlas. (select 1)
You have a configuration file for mongod instance called mongod.conf in your working directory. How can you launch mongod instance with this configuration file?
Why is high cardinality important when choosing a shard key?
You have a developers collection with the following document structure: { _id: 1, fname: 'John', lname: 'Smith', tech_stack: ['sql', 'git', 'python', 'linux', 'django', 'aws'] }, { _id: 2, fname: 'Michael', lname: 'Doe', tech_stack: [ 'git', 'python', 'sqlite', 'linux', 'flask' ] } Which of the following queries will return only the first three elements of the array in the tech_stack field?
You want to execute the following query quite often in your application: db.hotels.aggregate([ { "$match": { "stars": { "$gt": 4.5 } } }, { "$sort": { "stars": 1 } } ]) Your collection doesn't have any additional indexes. Which index should you create to support this query?
What stages will cause a merge on the primary shard for a database?
Suppose you have an accounts collection in your database. Only the following documents are stored in this collection: { _id: ObjectId("61af47c6e29861661d063714"), account_id: 1010, type: 'investment', limit: 2000000 }, { _id: ObjectId("61af47c6e29861661d063715"), account_id: 4336, type: 'derivatives', limit: 100000 }, { _id: ObjectId("61af47c6e29861661d063716"), account_id: 4336, type: 'commodity', limit: 1000 }, { _id: ObjectId("61af47c6e29861661d067825"), account_id: 7355, type: 'commodity', limit: 500000 }, { _id: ObjectId("61b1bde1ceb6f770f56b0cd9"), account_id: 4915, type: 'investment', limit: 2000000 } How many documents will be returned in response to the following aggregation pipeline? [{ $group: { _id: "$type", number_of_accounts: { $sum: 1 } }}, { $match: { number_of_accounts: { $gt: 1 } }}]
Select all true statements regarding to pipelines and the Aggregation Framework.
Select true statements about index performance.
What is the best practice in using the $match operator?
Select all true statement regarding to the MongoDB (BSON, JSON). (select 3)