Not getting what to do in notebook for Ticket Projection

Are we suppose to change get_db method as well??
def get_db():
Configuration method to return db instance
db = getattr(g, “_database”, None)
MFLIX_DB_URI = current_app.config[“MFLIX_DB_URI”]
if db is None:

    Ticket: Connection Pooling

    Please change the configuration of the MongoClient object by setting the
    maximum connection pool size to 50 active connections.

    Ticket: Timeouts

    Please prevent the program from waiting indefinitely by setting the
    write concern timeout limit to 2500 milliseconds.

    db = g._database = MongoClient(MFLIX_DB_URI,connectTimeoutMS=2500,retryWrites=True
    # TODO: Connection Pooling
    # Set the maximum connection pool size to 50 active connections.
    # TODO: Timeouts
    # Set the write timeout limit to 2500 milliseconds.
return db

Use LocalProxy to read the global db instance with just db

db = LocalProxy(get_db)

This is my get_db function.Is it correct?What changes i have to do or from where i have to fetch uri??

def get_movies_by_country(countries):
Finds and returns movies by country.
Returns a list of dictionaries, each dictionary contains a title and an _id.

    Ticket: Projection

    Write a query that matches movies with the countries in the "countries"
    list, but only returns the title and _id of each movie.

    Remember that in MongoDB, the $in operator can be used with a list to
    match one or more values of a specific field.

    # TODO: Projection
    # Find movies matching the "countries" list, but only return the title
    # and _id. Do not include a limit in your own implementation, it is
    # included here to avoid sending 46000 documents down the wire.
    return list(db.movies.find({ “countries” : { “$in” : countries } }, { “title” : 1 } ))

except Exception as e:
    return e

And is the function for projection written by me correctly??

Please explain in detail i am really unable to understand specifically get_db part


No. The configuration for your cluster will be configured from .ini file which you might have done in README lecture.

You specifically need to write code in the TODO sections , working on each part and then checking back to the unit test for the exercise to see if you have completed correctly.

If the test passes, then you should reload the UI to get the verification code to progress to the next exercise.