Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Next, you must develop a Python module in a PY file, using object - oriented programming methodology, to enable CRUD functionality for the database. Other

Next, you must develop a Python module in a PY file, using object-oriented programming methodology, to enable CRUD functionality for
the database. Other Python scripts must be able to import your Python code, so it must support code reusability.
Develop a CRUD class that, when instantiated, provides the following functionality:
A Create method that inserts a document into a specified MongoDB database and collection
Input -> argument to function should be the key/value lookup pair to use with the MongoDB driver find API call.
Return -> "True" if successful insert, else "False".
A Readmethod that queries for document(s) from a specified MongoDB database and specified collection
Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver find API call.
Return -> result in a list if the command is successful, else an empty list.
Important: Be sure to use find() instead of find_one() when developing your method. Hint: You will have to work with the MongoDB
cursor returned by the find() method.
An Update method that queries for and changes document(s) from a specified MongoDB database and specified collection
Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver Find API call. The last argument
to function will be a set of key/value pairs in the data type acceptable to the MongoDB driver update_one() or update_many() API
call.
Return -> The number of objects modified in the collection.
A Delete method that queries for and removes document(s) from a specified MongoDB database and specified collection
Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver find API call.
Return -> The number of objects removed from the collection.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the value of various recruitment methods?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago