C100DEV
C100DEV
com
The safer , easier way to help you pass any IT exams.
Exam : C100DEV
Version : DEMO
1 / 3
The safer , easier way to help you pass any IT exams.
2.Suppose you have a movies collection with the following document structure:
{
_id: ObjectId("573a1390f29313caabcd60e4"),
title: 'The Immigrant',
fullplot: "Charlie is on his way to the USA. He wins in a card game, puts the money in Edna's bag (she
and her sick mother have been robbed of everything). When he retrieves a little for himself he is accused
of being a thief. Edna clears his name. Later, broke, Charlie finds a coin and goes into a restaurant." }
You want to perform text search queries on fullplot field.
What do you have to do?
Just query the database. For example:
A. Just query the database. For example:
db.movies.find( { $text: { $search: 'spaceship'} } ).explain()
B. First, create a text index: db.movies.createIndex( { fullplot: 'text' } ) Then query the database:
db.movies.find( { $text: { $search: 'spaceship' } } )
C. First, create an index:
D. db.movies.createIndex( { fullplot: 1 } ) Then query the database:
db.movies.find( { $text: { $search: 'spaceship' } } )
Answer: B
Explanation:
https://docs.mongodb.com/manual/text-search/
https://docs.mongodb.com/manual/core/index-text/
3.In your database there is a collection named trips with the following document structure:
{
'_id': ObjectId("572bb8222b288919b68abf6d"),
'trip_duration': 858,
'start_station id': 532,
'end_station_id': 401,
'bike_id': 17057,
'start_station_location': { type: 'Point', coordinates: [ -73.960876, 40.710451 ] }, 'end_station_location':
{ type: 'Point', coordinates: [ -73.98997825, 40.72019576 ] }, 'start_time': ISODate("2016-01-
01T00:09:31.000Z"), 'stop_time': ISODate("2016-01-01T00:23:49.000Z") }
How can you extract all trips from this collection ended at stations that are to the west of the -73.5
longitude coordinate?
A. db.trips.find( { 'coordinates': { $lt: -73.5 } } )
B. db.trips.find( { 'end_station_location.coordinates.0': { $gt: -73.5 } } )
2 / 3
The safer , easier way to help you pass any IT exams.
3 / 3