Question
Update an existing cloud function to add additional functionality that writes to a NoSQL database. You will be moving from v.1 to v.2 of your
Update an existing cloud function to add additional functionality that writes to a NoSQL database.
You will be moving from v.1 to v.2 of your "Extract EXIF" cloud function.
Instructions MongoDB
1. Create a new Mongo project for 41200-mapmytrip.
2. Add a new, empty cluster to the project.
3. Update your Network Access to allow connections from any IP address.
4. Use the Database Access to create a new DB user (and copy the password.)
5. From the Cluster window, choose Connect and copy the connection string for your database.
a. Substitute the copied password from step 4 into the connection string
b. Add MapMyTrip as the database name in your connection string
Instructions Write Your Function Logic
Make the following updates to your function's logic:
1. In your helper function that logs the EXIF data to the console (mine was called logExif):
a. Create a plain JSON object named exifObject that includes the following key/value pairs:
i. fileName Should contain the file name of the file that triggered the cloud function.
ii. createDate Contains the CreateDate attribute of the files EXIF data
iii. latitude The parsed latitude coordinates in decimal form (e.g. 42.891736)
iv. latitude The parsed longitude coordinates in decimal form (e.g. 71.891736)
b. Return the exifObject from the logExif function
2. Create a new helper function called writeToDatabase that has one parameter
a. Pass the exifObject to the writeToDatabase function
b. Use what youve learned about writing to MongoDB to write the exifObject into an images collection in your MapMyTrip database (specified in your connection string)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started