use-mongodb-database-and-juypter-notebook-to-answer-questions-1

Please submit the Jupyter Notebook and a pdf of the notebook. Use mongoDB queries for the following tasks:

  1. Import the compustat csv file into a collection. (the same file we used in MySQL homework).
    1. Use mongoimport with specified field types
  2. Define a new collection called compustatWithSchema with schema validation.
  3. Insert data from the compustat collection to the compustatWithSchema collection.
  4. Get the total number of documents inside the collection.
  5. Get the total number of distinct value in field “fqtr”. Please note that the distinct() function returns an array instead of documents.
  6. Return fields (datadate, tic, atq, ltq) from documents which have atq larger than 10,000. Please limit the output records to 5.
  7. Calculate the average atq for each ticker when the fyearq is larger than 2015. Please limit the output records to 10.
  8. Save all output records from question 7 into a new collection.
  9. Export the collection from question 6 to a csv file.
    1. Use mongoexport with specified field types
    2. Use mongoexport with specified field types and query for tickers AAPL and ZNGA