MongoDB Mock Test 1 Flashcards

1
Q
  1. Which numeric type is a valid MongoDB BSON type?

(Choose 1)

A. Float

B. Number

C. BIGINT

D. 32-bit integer

A

(D) 32-bit integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Given the following documents in a collection:

{ _id: 1, n: [1,2,5], p: 0.75, c: 'Green' },
{ _id: 2, n: 'Orange', p: 'Blue', c: 42, q: 14 },
{ _id: 3, n: [1,3,7], p: 0.85, c: 'Orange' }

Which two documents can successfully be added in the same collection?

(Choose 2)

A. { _id: 1, n: [1,2,5], p: 0.75, c: 'Green' }

B. { _id: 5, n: [1,2,5], p: 0.75, c: 'Green' }

C. { _id: 2, n: [1,2,5], p: 0.75, c: 'Green' }

D. { _id: 6, n: [1,3,7], p: 0.85, c: 'Orange }
A

(B)
~~~
{ _id: 5, n: [1,2,5], p: 0.75, c: ‘Green’ }
~~~

(D)
~~~
{ _id: 6, n: [1,3,7], p: 0.85, c: ‘Orange }
~~~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Given the following documents in a collection:

{_id: 1, txt: "just some text"},
{_id: 2, txt: "just some text"}

Which two documents can successfully be added in the same collection?

(Choose 2)

A. {_id: 0, txt: "just some text"}

B. {_id: 1, txt: "just some text"}

C. {_id: [4], txt: "just some text"}

D. {_id: 3, txt: "just some text"}
A

(A)
~~~
{_id: 0, txt: “just some text”}
~~~

(D)
~~~
{_id: 3, txt: “just some text”}
~~~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Given the following document:

The name is a.log, the owner of the file is applicationA, the size of the file is 1KB, and the file was deleted.

What command will properly add this document to the files collection using mongosh?

(Choose 1)

A. db.files.insertOne({ file: "a.log", owner: "applicationA", size: 1KB, deleted: true })

B. db.files.insertOne({ file: "a.log", owner: "applicationA", size: 1KB, deleted: True })

C. db.files.insertOne({ file: "a.log", owner: "applicationA", size: 1024, deleted: true })

D. db.files.insertOne({ file: "a.log", owner: "applicationA", size: 1024, deleted: True })
A

(C)
~~~
db.files.insertOne({ file: “a.log”, owner: “applicationA”, size: 1024, deleted: true })
~~~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Given the following sample documents in products collection:

{ "name" : "XPhone", "price" : 799, "color" : [ "white", "black" ], "storage" : [ 64, 128, 256 ] },

{ "name" : "XPad", "price" : 899, "color" : [ "white", "black", "purple" ], "storage" : [ 128, 256, 512 ] },

{ "name" : "GTablet", "price" : 899, "color" : [ "blue" ], "storage" : [ 16, 64, 128 ] },

{ "name" : "GPad", "price" : 699, "color" : [ "white", "orange", "gold", "gray" ], "storage" : [ 128, 256, 1024 ] },

{ "name" : "GPhone", "price" : 599, "color" : [ "white", "orange", "gold", "gray" ], "storage" : [ 128, 256, 512 ] }
Given the following query:

db.products.find({$and : [{"price" : {$lte : 800}},
                                       {$or : [{"color" : "purple"}, {"storage" : 1024}]}]})

What is the correct output of the query?
Choose 1)

A. { "name" : "XPhone", "price" : 799, "color" : [ "white", "black" ], "storage" : [ 64, 128, 256 ] }

B. { "name" : "XPad", "price" : 899, "color" : [ "white", "black", "purple" ], "storage" : [ 128, 256, 512 ] }

C. { "name" : "GPhone", "price" : 599, "color" : [ "white", "orange", "gold", "gray" ], "storage" : [ 128, 256, 512 ] }

D. { "name" : "GPad", "price" : 699, "color" : [ "white", "orange", "gold", "gray" ], "storage" : [ 128, 256, 1024 ] }
A

(D)

{ "name" : "GPad", "price" : 699, "color" : [ "white", "orange", "gold", "gray" ], "storage" : [ 128, 256, 1024 ] }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

An inventory collection consists of 200 documents.

What method should be used to get all documents from a cursor using mongosh?

(Choose 1)

A. db.inventory.findOne()

B. db.inventory.find().toArray();

C. db.inventory.find();

D. db.inventory.findMany().toArray()

A

(B)

db.inventory.find().toArray();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A collection has documents like the following:

 { _id: 1, name: 'Oatmeal Fruit Cake with Gummy Bears ', price: 11)},
 { _id: 2, name: 'Cheesecake Trifle with Chocolate Sprinkles ', price: 14)},
 { _id: 3, name: 'Pistachio Brownie with Walnuts ', price: 5},
 { _id: 4, name: 'Strawberry Ice Cream Cake with Butterscotch Syrup ', price: 3)}

How should the ‘autocomplete’ index be defined to look for matches at the beginning of a word on the name field?

(Choose 1)

A. {  "mappings": {    "dynamic": false,    "fields": {         "name": [   {  "type": "autocomplete",                              "tokenization": "regexCaptureGroup"} ]     } }}

B. {  "mappings": {    "dynamic": false,    "fields": {         "name": [   {  "type": "autocomplete",                              "tokenization": "edgeGram"} ]    } }}

C. {  "mappings": {    "dynamic": false,    "fields": {         "name": [   {  "type": "autocomplete",                              "tokenization": "nGram"} ]    } }}

D. {  "mappings": {    "dynamic": false,    "fields": {         "name": [   {  "type": "autocomplete",                              "tokenization": "matchNGram"}} ]     } }}
A

(B)

 {  "mappings": {    "dynamic": false,    "fields": {         "name": [   {  "type": "autocomplete",                              "tokenization": "edgeGram"} ]    } }}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Given the following sample documents:

{_id:1, name: "Quesedillas Inc.", active: true },
{_id:2, name: "Pasta Inc.", active: true },
{_id:3, name: "Tacos Inc.", active: false },
{_id:4, name: "Cubanos Inc.", active: false },
{_id:5, name: "Chicken Parm Inc.", active: false }

A company wants to create a mobile app for users to find restaurants by name. The developer wants to show the user restaurants that match their search. An Atlas Search index has already been created to support this query.

What query satisfies these requirements?

(Choose 1)
~~~
A. db.restaurants.aggregate([{ “$search”: { “text”: { “path”: “name”, “synonym”: “cuban”} } }])

B. db.restaurants.aggregate([{ “$search”: { “text”: { “path”: “name”, “query”: “cuban”} } }])

C. db.restaurants.aggregate([{ “$search”: { “text”: { “field”: “name”, “query”: “cuban”} } }])

D. db.restaurants.aggregate([{ “$search”: { “text”: { “field”: “name”, “synonym”: “cuban”} } }])
~~~

A

(B)

db.restaurants.aggregate([{    "$search": {      "text": { "path": "name", "query": "cuban"}    } }])
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Given the data set and query:

{ "_id" : ObjectId("512bc95fe835e68f199c8686"), "player" : "p1", "score" : 89 }
{ "_id" : ObjectId("512bc962e835e68f199c8687"), "player" : "p2", "score" : 85 }
{ "_id" : ObjectId("55f5a192d4bede9ac365b257"), "player" : "p2", "score" : 65 }
{ "_id" : ObjectId("55f5a192d4bede9ac365b258"), "player" : "p3", "score" : 65 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b259"), "player" : "p3", "score" : 75 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25a"), "player" : "p5", "score" : 70 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25b"), "player" : "p6", "score" : 100 }

db.scores.aggregate(
[{ $group: {
      _id: '$player',
      score: {
           $avg: '$score'
      }
 },
 { $match: {
     score: { 
            $gt: 70
      }
 }
])

What is the output?​

(Choose 1)

A. { "player" : "p1", "score" : 89 } { "player" : "p2", "score" : 85 } { "player" : "p3", "score" : 75 } { "player" : "p6", "score" : 100 }

B. { "player" : "p1", "score" : 89 } { "player" : "p2", "score" : 75 } { "player" : "p6", "score" : 100 }

C. { "player" : "p1", "score" : 89 } { "player" : "p2", "score" : 75 } { "player" : "p3", "score" : 70 } { "player" : "p5", "score" : 70 } { "player" : "p6", "score" : 100 }

D. { "player" : "p1", "score" : 89 } { "player" : "p2", "score" : 75 } { "player" : "p3", "score" : 70 } { "player" : "p6", "score" : 100 }
A

(B)

{ "player" : "p1", "score" : 89 } { "player" : "p2", "score" : 75 } { "player" : "p6", "score" : 100 }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A collection coll in database mdb has the following documents :

{_id: 1, type: "A", value: 60}
{_id: 2, type: "B", value: 80}
{_id: 3, type: "C", value: 10}
After executing the following aggregation pipeline:

db.getSiblingDB("mdb").coll.aggregate([
    { $out: {db:'test', collection:'results'}} ])

What are two expected results?

(Choose 2)

A. Collection results is created in database test.

B. There is a syntax error command. Collection results is not created.

C. No documents in collection coll are written to collection results.

D. All documents in collection coll are written to collection results.

A

(B) There is a syntax error command. Collection results is not created.

(C) No documents in collection coll are written to collection results.

The syntax error is the use of $out in the aggregation stage. It should be used outside of the aggregation pipeline.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Given the following documents:

{_id:1, a: "one", b: "four"}
{_id:2, a: "two", b: "four"}
{_id:3, a: "three", b: "four", c: "three"}

If the following command is executed:

db.coll.replaceOne({}, {a: "ten", b: "five"})

What is the result?

(Choose 1)

A. {_id:1, a: "ten", b: "five"} {_id:2, a: "ten", b: "five"} {_id:3, a: "ten", b: "five"}

B. {_id:1, a: "ten", b: "five"} {_id:2, a: "two", b: "four"} {_id:3, a: "three", b: "four", c: "three"}

C. {_id:1, a: "ten", b: "five"} {_id:2, a: "ten", b: "five"} {_id:3, a: "ten", b: "five", c: "three"}

D. {_id:1, a: "one", b: "four"} {_id:2, a: "two", b: "four"} {_id:3, a: "three", b: "four", c: "three"}
A

(B)

```
{_id:1, a: “ten”, b: “five”} {_id:2, a: “two”, b: “four”} {_id:3, a: “three”, b: “four”, c: “three”}
~~~

The replaceOne method updates the first document that matches the filter with the replacement document. In this case, the filter is empty, meaning it will match the first document in the collection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Given the collection called coll, with only the following documents,

{
 _id:1,
 a:1,
 b:1
},
{
 _id:2,
 a:2
}

The update operation db.coll.updateMany({},{$set:{b:2}}) successfully completes.

What is the output of db.coll.find()?

(Choose 1)

A. [{_id:1,  b:2}, {_id:2,  b:2}]

B. [{_id:1,  a:1,  b:2}, {_id:2,  a:2}]

C. [{_id:1,  a:1,  b:1}, {_id:2,  a:2,  b:2}]

D. [{_id:1,  a:1,  b:2}, {_id:2,  a:2,  b:2}]
A

(D)

[{_id:1,  a:1,  b:2}, {_id:2,  a:2,  b:2}]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Given the following documents:

{_id:1, a: “one”, b: “four”}
{_id:2, a: “two”, b: “four”}
{_id:3, a: “three”, b: “four”, c: “three”}
If the following command is executed:

db.coll.replaceOne({}, {a: “ten”, b: “five”})
~~~

What is the result?

(Choose 1)

A. {_id:1, a: "ten", b: "five"} {_id:2, a: "ten", b: "five"} {_id:3, a: "ten", b: "five"}

B. {_id:1, a: "ten", b: "five"} {_id:2, a: "two", b: "four"} {_id:3, a: "three", b: "four", c: "three"}

C. {_id:1, a: "ten", b: "five"} {_id:2, a: "ten", b: "five"} {_id:3, a: "ten", b: "five", c: "three"}

D. {_id:1, a: "one", b: "four"} {_id:2, a: "two", b: "four"} {_id:3, a: "three", b: "four", c: "three"}
A

(B)

{_id:1, a: "ten", b: "five"} {_id:2, a: "two", b: "four"} {_id:3, a: "three", b: "four", c: "three"}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Given the collection called coll, with only the following documents,

{
 _id:1,
 a:1,
 b:1
},
{
 _id:2,
 a:2
}

The update operation db.coll.updateMany({},{$set:{b:2}}) successfully completes.

What is the output of db.coll.find()?

(Choose 1)

A. [{_id:1,  b:2}, {_id:2,  b:2}]

B. [{_id:1,  a:1,  b:2}, {_id:2,  a:2}]

C. [{_id:1,  a:1,  b:1}, {_id:2,  a:2,  b:2}]

D. [{_id:1,  a:1,  b:2}, {_id:2,  a:2,  b:2}]
A

(D)

[{_id:1,  a:1,  b:2}, {_id:2,  a:2,  b:2}]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Given the following document from the cakeFlavors collection. All documents in this collection have the same schema.

{
"_id" : 1,
"flavor" : "chocolate",
"number" : 15
}

What operation on the cakeFlavors collection will update the value of the number field to 100 for a document with a “strawberry” flavor value and insert a new document if it does not exist?

(Choose 1)

A. db.cakeFlavors.updateOne({ flavor: "strawberry"} , { $set: { number: 100 } }, { $upsert: true })

B. db.cakeFlavors.insertOne({ flavor: "strawberry"} , { $set: { number: 100 } }, { $upsert: true })

C. db.cakeFlavors.insertOne({ flavor: "strawberry"} , { $set: { number: 100 } }, { upsert: true }) 

D. db.cakeFlavors.updateOne({ flavor: "strawberry"} , { $set: { number: 100 } }, { upsert: true })
A

(D)

db.cakeFlavors.updateOne({ flavor: "strawberry"} , { $set: { number: 100 } }, { upsert: true })
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Given the following example document from the movie collection:

{
   _id: ObjectId("62872ccd590c3c06d78af00d"),
   genres: [ "Drama", "Romance", "War" ],
   title: "A.B.",
   year: 1921,
   tomatoes: { rating: 3.9, votes: 507, id: "76" },
   countries: [ "USA" ],
   classic : false
}

All documents in this collection have the same schema.

What command updates the value of the classic field to true for all documents with a year value less than 2000?

(Choose 1)

A. db.movie.updateOne({ year: { $lt: 2000 } }, { $set: { classic: true } }, { multi: true })

B. db.movie.updateMany({ year: { $lt: 2000 } }, { $set: { classic: true } }) 

C. db.movie.updateMulti({ year: { $lt: 2000 } }, { $set: { classic: true } })

D. db.movie.updateBulk({ year: { $lt: 2000 } }, { $set: { classic: true } })
A

(B)

db.movie.updateMany({ year: { $lt: 2000 } }, { $set: { classic: true } })
17
Q

Given the following sample documents in the loans collection:

{ _id: 122, book: "ABC", name: "L.A.", date: ISODate("2022-05-20") },
{ _id: 343, book: "EFF", name: "T.B.", date: ISODate("2022-05-22") },
{ _id: 454, book: "CFH", name: "M.C.", date: ISODate("2022-05-12") }

What command deletes document which book is “EFF” and user is “T.B.”, and returns the deleted document?

(Choose 1)

A. db.loans.deleteOne( { book: "EFF", name: "T.B." } )

B. db.loans.findOneAndDelete( { book: "EFF", name: "T.B." } ) 

C. db.loans.remove( { book: "EFF", name: "T.B." } , {returnDocument: true} ) 

D. db.loans.deleteOne( { book: "EFF", name: "T.B." }, {returnDocument: true} )
A

(B)

 db.loans.findOneAndDelete( { book: "EFF", name: "T.B." } )
18
Q

Given the following sample documents in the inventory collection:

{ _id: 6305, name : "A. S.", "assignment" : 5, "status" : "A" },   
{ _id: 6308, name : "B. M.", "assignment" : 3, "status" : "B" },   
{ _id: 6312, name : "E. M.", "assignment" : 5, "status" : "C" },   
{ _id: 6319, name : "R. S.", "assignment" : 2, "status" : "D" },   
{ _id: 6322, name : "A. S.", "assignment" : 2, "status" : "A" },   
{ _id: 6234, name : "R. S.", "assignment" : 1, "status" : "B" },
{ _id: 6235, name : "A. S.", "assignment" : 1, "status" : "C" },
{ _id: 6315, name : "E. M.", "assignment" : 3, "status" : "A" }

What expression will remove all documents with “status” : “C” in the inventory collection?

(Choose 1)

A. db.inventory.delete ({"status" : "C"})

B. db.inventory.deleteOne ({"status" : "C"})

C. db.inventory.deleteMany ({"status" : "C"}) 

D. db.inventory.findOneAndDelete ({"status" : "C"})
A

(C)

db.inventory.deleteMany ({"status" : "C"})
19
Q

Given the following documents in the ratings collection:

{ _id: 0, hotel: "AAA", rating: 4.5 },
{ _id: 1, hotel: "BBB", rating: 3.0 },
{ _id: 2, hotel: "CCC", rating: 4.2 }

What mongosh command will return a document for hotel “CCC”?

(Choose 1)

A. db.ratings.return_one( {hotel: "CCC"} )

B. db.ratings.find_one( {hotel: "CCC"} ) 

C. db.ratings.returnOne( {hotel: "CCC"} )

D. db.ratings.findOne( {hotel: "CCC"} )
A

(D)

db.ratings.findOne( {hotel: "CCC"} )
20
Q

The following query generates a collection scan:

db.people.find({employer : "ABC" }).sort ({last_name:1 , job:1})

Which two indexes will most improve the performance of the query?

(Choose 2)

A. db.people.createIndex({employer:1, last_name : 1  , job : 1 } ) 

B. db.people.createIndex({employer:1, last_name : -1  , job : -1 } ) 

C. db.people.createIndex({employer:1,last_name : -1  , job : 1 } 

D. db.people.createIndex({employer:1,last_name : 1  , job : -1 } )
A

(A) + (B)

1.
~~~
db.people.createIndex({employer:1, last_name : 1 , job : 1 } )
~~~

2.
~~~
db.people.createIndex({employer:1, last_name : -1 , job : -1 } )
~~~

21
Q

Given a collection called collection, in which all documents have the following shape:

{
 _id:1,
 objs:[
   {a:1,b:2},{a:2,b:1}
 ] 
}

And the query on this collection:

db.collection.find({“objs.a”:1})
What index will support this query?

(Choose 1)

A. {"objs.a":1} 

B. {objs:1}

C. {objs:1,"objs.a"1}

D. {objs:1,"a"1}
A

(A)

{"objs.a":1}

To optimize this query, the index should mirror the structure of the query, so an index like {“objs.a”:1} directly supports searching for documents based on the specified field within the array. This helps the database engine quickly locate the relevant documents, improving query performance.

22
Q

Given the following query:

db.coll.find({}).sort({"product": 1, "price": 1})

Which two indexes will improve the performance of this query?

(Choose 2)

A. {"product": 1, "price": 1} 

B. {"product": 1, "price": -1}

C. {"product": -1, "price": 1}

D. {"product": -1, "price": -1}
A

(A) + (D)

1.

{"product": 1, "price": 1}
  1. {"product": -1, "price": -1}
23
Q

Given the following query:

db.coll.find({}).sort({"product": 1, "price": 1})

Which two indexes improve the performance of this query the most?

(Choose 2)

A. { v: 2, key: { price: 1, product: 1 }, name: 'price_1_product_1' }

B. { v: 2, key: { product: 1, price: 1 }, name: 'product_1_price_1' } 

C. { v: 2, key: { price: -1, product: -1 }, name: 'price_-1_product_-1' }

D. { v: 2, key: { product: -1, price: -1 }, name: 'product_-1_price_-1' }
A

(B) + (D)

1.

{ v: 2, key: { product: 1, price: 1 }, name: 'product_1_price_1' }
{ v: 2, key: { product: -1, price: -1 }, name: 'product_-1_price_-1' }
24
Q

What mongosh command shows how many indexes are associated with an inventory collection?

(Choose 1)

A. db.inventory.getIndexes()

B. db.inventory.showIndexes()

C. db.inventory.displayIndexes()

D. db.inventory.indexes()
A

(A)

db.inventory.getIndexes()
25
Q

A typical products collection is in an e-commerce database.

What schema is the most effective?

(Choose 1)

A. Orders for products should be embedded as an array in each product document. 

B. Reviews for products should be embedded as an array in each product document.

C. Current and historical prices for product should be embedded in each product document.

D. Current inventory/availability for product should be embedded in each product document.
A

(D)

Current inventory/availability for product should be embedded in each product document.

26
Q

A Cooking dataset is in Atlas. There is a Recipes database with a Desserts collection.

How can one document be found that provides a recipe for cookies without chocolate using Atlas Data Explorer?

(Choose 1)

A. 1. Select the collection on the left-hand side. 2. Select the "Aggregation" view. 3. Specify the first stage as `$match` query: {dessert_type: "Cookie"} ``` 4. Specify the second stage as `$match` query: ``` {ingredients: {$all: ["chocolate"]}} 5. Set `$limit` to 1.

B. 1. Select the collection on the left-hand side. 2. Select the "Aggregation" view. 3. Specify the first stage as `$match` query: ``` {dessert_type: "Cookie", ingredients: {$nin: ["chocolate"]}} ``` 4. Set `$limit` to 1. 

C. 1. Select the collection on the left-hand side. 2. Specify the "Find" view. 3. Specify the filter query: ``` {dessert_type: "Cookie", ingredients: {$nin: ["chocolate"]} ``` 4. Specify the project query: ``` {dessert_type: 1}

D. 1. Select the collection on the left-hand side. 2. Specify the "Find" view. 3. Specify the filter query with limit: ``` {dessert_type: "Cookie", ingredients: {$nin: ["chocolate"], $limit: 1}
A

(B)

1. Select the collection on the left-hand side. 2. Select the "Aggregation" view. 3. Specify the first stage as `$match` query:  {dessert_type: "Cookie", ingredients: {$nin: ["chocolate"]}} 4. Set `$limit` to 1.
27
Q

What are two valid method names for the MongoClient class?

(Choose 2)

A. close() 

B. open()

C. destroy()

D. getDatabase()
A

(A) + (D)

  1. close()
  2. getDatabase()
28
Q

What are two advantages to using Connection Pooling within the Java Driver?

(Choose 2)

A. Reduce the latency for an application. 

B. Limit the number of connections to the server. 

C. Remove the need for the application to authenticate.

D. Remove the need to open and close connections in the application.
A

(A) + (B)

  1. Reduce the latency for an application.
  2. Limit the number of connections to the server.
29
Q

Assuming correct imports, properly instantiated MongoClient called client, and given the following Java code:

MongoCollection collection = client.getDatabase(“employees”).getCollection(“records”);
Bson filter = eq(“position”, “Developer Advocate”);
Bson update = set(“position”, “Developer Evangelist”);
What is the correct syntax for updating multiple documents with a single command?

(Choose 1)

A. collection.UpdateMany(update, filter);

B. collection.UpdateMany(filter, update); 

C. collection.UpdateMultiple(update, filter);

D. collection.UpdateMultiple(filter, update);
A

(B)

collection.UpdateMany(filter, update);

30
Q

Given the following sample documents:

{_id:1, name: "Quesedillas Inc.", active: true },
{_id:2, name: "Pasta Inc.", active: true },
{_id:3, name: "Tacos Inc.", active: false },
{_id:4, name: "Cubanos Inc.", active: false },
{_id:5, name: "Chicken Parm Inc.", active: false },

A company wants to create a mobile app for users to find restaurants by name. The developer wants to show the user restaurants that match their search. An Atlas Search index has already been created to support this query.

What query satisfies these requirements?

(Choose 1)

A. db.restaurants.aggregate([{    "$search": {      "text": { "path": "name", "synonym": "cuban"}    } }])

B. db.restaurants.aggregate([{    "$search": {      "text": { "path": "name", "query": "cuban"}    } }]) 

C. db.restaurants.aggregate([{    "$search": {      "text": { "field": "name", "query": "cuban"}    } }])

D. db.restaurants.aggregate([{    "$search": {      "text": { "field": "name", "synonym": "cuban"}    } }])
A

(B)

db.restaurants.aggregate([{    "$search": {      "text": { "path": "name", "query": "cuban"}    } }])